Merge branch 'master' into issue4903-unnecessaryboxing

This commit is contained in:
Clément Fournier committed 2024-05-23 20:15:47 +02:00
commit f1fc7aacbe
128 files changed
+2720 -2256

No files matched your search

+48 -1
View File
@@ -7071,7 +7071,8 @@
"avatar_url": "https://avatars.githubusercontent.com/u/26581168?v=4",
"profile": "https://github.com/mluckam",
"contributions": [
"code"
"code",
"bug"
]
},
{
@@ -7534,6 +7535,52 @@
"contributions": [
"bug"
]
},
{
"login": "cowwoc",
"name": "Gili Tzabari",
"avatar_url": "https://avatars.githubusercontent.com/u/633348?v=4",
"profile": "https://github.com/cowwoc",
"contributions": [
"bug"
]
},
{
"login": "bobalicious",
"name": "Rob Baillie",
"avatar_url": "https://avatars.githubusercontent.com/u/6523911?v=4",
"profile": "http://robertbaillie.blogspot.co.uk/",
"contributions": [
"bug"
]
},
{
"login": "mdagcilar",
"name": "Metin Dagcilar",
"avatar_url": "https://avatars.githubusercontent.com/u/6627550?v=4",
"profile": "https://github.com/mdagcilar",
"contributions": [
"bug"
]
},
{
"login": "kesslerj",
"name": "Jonas Keßler",
"avatar_url": "https://avatars.githubusercontent.com/u/25590499?v=4",
"profile": "https://github.com/kesslerj",
"contributions": [
"bug"
]
},
{
"login": "Gold856",
"name": "Gold856",
"avatar_url": "https://avatars.githubusercontent.com/u/117957790?v=4",
"profile": "https://github.com/Gold856",
"contributions": [
"bug",
"code"
]
}
],
"contributorsPerLine": 7,
+12 -10
View File
@@ -4,7 +4,7 @@ GEM
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
base64 (0.2.0)
bigdecimal (3.1.6)
bigdecimal (3.1.8)
claide (1.1.0)
claide-plugins (0.9.2)
cork
@@ -28,7 +28,7 @@ GEM
octokit (>= 4.0)
terminal-table (>= 1, < 4)
differ (0.1.2)
et-orbi (1.2.8)
et-orbi (1.2.11)
tzinfo
faraday (2.9.0)
faraday-net_http (>= 2.0, < 3.2)
@@ -36,8 +36,8 @@ GEM
faraday (>= 0.8)
faraday-net_http (3.1.0)
net-http
fugit (1.10.1)
et-orbi (~> 1, >= 1.2.7)
fugit (1.11.0)
et-orbi (~> 1, >= 1.2.11)
raabro (~> 1.4)
git (1.19.1)
addressable (~> 2.8)
@@ -46,13 +46,13 @@ GEM
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (5.4.0)
liquid (5.5.0)
logger-colors (1.0.0)
nap (1.1.0)
net-http (0.4.1)
uri
no_proxy_fix (0.1.2)
nokogiri (1.16.2-x86_64-linux)
nokogiri (1.16.5-x86_64-linux)
racc (~> 1.4)
octokit (8.1.0)
base64
@@ -66,12 +66,13 @@ GEM
nokogiri (~> 1.13)
rufus-scheduler (~> 3.8)
slop (~> 4.9)
public_suffix (5.0.4)
public_suffix (5.0.5)
raabro (1.4.0)
racc (1.7.3)
racc (1.8.0)
rchardet (1.8.0)
rexml (3.2.6)
rouge (4.2.0)
rexml (3.2.8)
strscan (>= 3.0.9)
rouge (4.2.1)
rufus-scheduler (3.9.1)
fugit (~> 1.1, >= 1.1.6)
safe_yaml (1.0.5)
@@ -79,6 +80,7 @@ GEM
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
slop (4.10.1)
strscan (3.1.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
tzinfo (2.0.6)
+14 -16
View File
@@ -1,7 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (7.1.3.2)
activesupport (7.1.3.3)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -14,7 +14,7 @@ GEM
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
base64 (0.2.0)
bigdecimal (3.1.6)
bigdecimal (3.1.8)
coffee-script (2.4.1)
coffee-script-source
execjs
@@ -23,8 +23,8 @@ GEM
commonmarker (0.23.10)
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
csv (3.2.8)
dnsruby (1.71.0)
csv (3.3.0)
dnsruby (1.72.1)
simpleidn (~> 0.2.1)
drb (2.2.1)
em-websocket (0.5.3)
@@ -96,7 +96,7 @@ GEM
activesupport (>= 2)
nokogiri (>= 1.4)
http_parser.rb (0.8.0)
i18n (1.14.4)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
jekyll (3.9.5)
addressable (~> 2.4)
@@ -219,23 +219,24 @@ GEM
jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
minitest (5.22.2)
minitest (5.23.1)
mutex_m (0.2.0)
net-http (0.4.1)
uri
nokogiri (1.16.2-x86_64-linux)
nokogiri (1.16.5-x86_64-linux)
racc (~> 1.4)
octokit (4.25.1)
faraday (>= 1, < 3)
sawyer (~> 0.9)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (5.0.4)
racc (1.7.3)
public_suffix (5.0.5)
racc (1.8.0)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
rb-inotify (0.11.1)
ffi (~> 1.0)
rexml (3.2.6)
rexml (3.2.8)
strscan (>= 3.0.9)
rouge (3.30.0)
rubyzip (2.3.2)
safe_yaml (1.0.5)
@@ -247,17 +248,14 @@ GEM
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
simpleidn (0.2.1)
unf (~> 0.1.4)
simpleidn (0.2.3)
strscan (3.1.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.9.1)
unicode-display_width (1.8.0)
uri (0.13.0)
webrick (1.8.1)
File diff suppressed because it is too large. Load diff
+17
View File
@@ -24,6 +24,11 @@ Since this release, PMD will also expose any getter returning a collection of an
/UserClass[@InterfaceNames = 'Queueable']
```
#### Updated PMD Designer
This PMD release ships a new version of the pmd-designer.
For the changes, see [PMD Designer Changelog (7.2.0)](https://github.com/pmd/pmd-designer/releases/tag/7.2.0).
### 🐛 Fixed Issues
* core
* [#4467](https://github.com/pmd/pmd/issues/4467): \[core] Expose collections from getters as XPath sequence attributes
@@ -34,6 +39,9 @@ Since this release, PMD will also expose any getter returning a collection of an
* [#4973](https://github.com/pmd/pmd/pull/4973): \[java] Stop parsing Java for CPD
* [#4980](https://github.com/pmd/pmd/issues/4980): \[java] Bad intersection, unrelated class types java.lang.Object\[] and java.lang.Number
* [#4988](https://github.com/pmd/pmd/pull/4988): \[java] Fix impl of ASTVariableId::isResourceDeclaration / VariableId/@<!-- -->ResourceDeclaration
* [#4990](https://github.com/pmd/pmd/issues/4990): \[java] Add an attribute @<!-- -->PackageQualifier to ASTClassType
* [#5006](https://github.com/pmd/pmd/issues/5006): \[java] Bad intersection, unrelated class types Child and Parent<? extends Child>
* [#5029](https://github.com/pmd/pmd/issues/5029): \[java] PMD 7.x throws stack overflow in TypeOps$ProjectionVisitor while parsing a Java class
* java-bestpractices
* [#4278](https://github.com/pmd/pmd/issues/4278): \[java] UnusedPrivateMethod FP with Junit 5 @MethodSource and default factory method name
* [#4852](https://github.com/pmd/pmd/issues/4852): \[java] ReplaceVectorWithList false-positive (neither Vector nor List usage)
@@ -41,6 +49,13 @@ Since this release, PMD will also expose any getter returning a collection of an
* [#4985](https://github.com/pmd/pmd/issues/4985): \[java] UnusedPrivateMethod false-positive / method reference in combination with custom object
* java-codestyle
* [#4930](https://github.com/pmd/pmd/issues/4930): \[java] EmptyControlStatement should not allow empty try with concise resources
* [#4954](https://github.com/pmd/pmd/issues/4954): \[java] LocalVariableNamingConventions should allow unnamed variables by default
* [#5028](https://github.com/pmd/pmd/issues/5028): \[java] FormalParameterNamingConventions should accept unnamed parameters by default
* java-errorprone
* [#4042](https://github.com/pmd/pmd/issues/4042): \[java] A false negative about the rule StringBufferInstantiationWithChar
* [#5007](https://github.com/pmd/pmd/issues/5007): \[java] AvoidUsingOctalValues triggers on non-octal double literals with a leading 0
* java-multithreading
* [#2368](https://github.com/pmd/pmd/issues/2368): \[java] False positive UnsynchronizedStaticFormatter in static initializer
### 🚨 API Changes
@@ -51,5 +66,7 @@ Since this release, PMD will also expose any getter returning a collection of an
### ✨ External Contributions
* [#5020](https://github.com/pmd/pmd/issues/5020): \[java] Fix AvoidUsingOctalValues false-positive - [Gold856](https://github.com/Gold856) (@Gold856)
{% endtocmaker %}
@@ -101,6 +101,11 @@ public final class StreamImpl {
}
}
@Override
public List<Node> toList() {
return Collections.unmodifiableList(Arrays.asList(array));
}
@Override
protected Iterator<Node> baseIterator() {
return Arrays.asList(array).iterator();
@@ -21,7 +21,7 @@ import net.sourceforge.pmd.lang.java.types.JClassType;
*
* </pre>
*/
public final class ASTAnnotation extends AbstractJavaTypeNode implements TypeNode, ASTMemberValue, Iterable<ASTMemberValuePair> {
public final class ASTAnnotation extends AbstractJavaTypeNode implements ASTMemberValue, Iterable<ASTMemberValuePair> {
ASTAnnotation(int id) {
super(id);
@@ -17,7 +17,7 @@ package net.sourceforge.pmd.lang.java.ast;
*
* </pre>
*/
public final class ASTArrayDimExpr extends ASTArrayTypeDim implements Annotatable {
public final class ASTArrayDimExpr extends ASTArrayTypeDim {
ASTArrayDimExpr(int id) {
super(id);
@@ -22,7 +22,7 @@ import java.util.Iterator;
* </pre>
*
*/
public final class ASTArrayInitializer extends AbstractJavaExpr implements ASTExpression, Iterable<ASTExpression> {
public final class ASTArrayInitializer extends AbstractJavaExpr implements Iterable<ASTExpression> {
ASTArrayInitializer(int id) {
super(id);
@@ -6,7 +6,6 @@ package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken;
import net.sourceforge.pmd.lang.java.ast.ASTList.ASTMaybeEmptyListOf;
import net.sourceforge.pmd.lang.java.ast.InternalInterfaces.AllChildrenAreOfType;
/**
* A block of code. This is a {@linkplain ASTStatement statement} that
@@ -19,7 +18,7 @@ import net.sourceforge.pmd.lang.java.ast.InternalInterfaces.AllChildrenAreOfType
* </pre>
*/
public final class ASTBlock extends ASTMaybeEmptyListOf<ASTStatement>
implements ASTSwitchArrowRHS, ASTStatement, AllChildrenAreOfType<ASTStatement> {
implements ASTSwitchArrowRHS, ASTStatement {
ASTBlock(int id) {
super(id, ASTStatement.class);
@@ -9,7 +9,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
/**
* The boolean literal, either "true" or "false".
*/
public final class ASTBooleanLiteral extends AbstractLiteral implements ASTLiteral {
public final class ASTBooleanLiteral extends AbstractLiteral {
private boolean isTrue;
@@ -14,7 +14,7 @@ package net.sourceforge.pmd.lang.java.ast;
*
* </pre>
*/
public final class ASTCastExpression extends AbstractJavaExpr implements ASTExpression {
public final class ASTCastExpression extends AbstractJavaExpr {
ASTCastExpression(int id) {
super(id);
@@ -15,7 +15,7 @@ import net.sourceforge.pmd.lang.document.Chars;
* retrieve the actual runtime value. Use {@link #getLiteralText()} to
* retrieve the text.
*/
public final class ASTCharLiteral extends AbstractLiteral implements ASTLiteral {
public final class ASTCharLiteral extends AbstractLiteral {
ASTCharLiteral(int id) {
@@ -7,6 +7,7 @@ package net.sourceforge.pmd.lang.java.ast;
import org.checkerframework.checker.nullness.qual.Nullable;
import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken;
import net.sourceforge.pmd.lang.java.symbols.JClassSymbol;
import net.sourceforge.pmd.lang.java.symbols.JTypeDeclSymbol;
import net.sourceforge.pmd.lang.java.types.JClassType;
import net.sourceforge.pmd.util.AssertionUtil;
@@ -125,6 +126,32 @@ public final class ASTClassType extends AbstractJavaTypeNode implements ASTRefer
}
/**
* Return the package qualifier, if this is a fully qualified name.
* Note that this will only be the case if we could resolve the
* qualifier to a package name during disambiguation. In other words,
* if the auxclasspath is not complete, and the qualifier could not
* be disambiguated, this method will return null (and an AmbiguousName
* will stay in the tree).
*
* <p>If a nested type is package-qualified, this method
* will only return a non-null result for the leftmost (=innermost)
* ASTClassType node. For instance in {@code java.util.Map.Entry},
* the node {@code java.util.Map} has package qualifier
* {@code "java.util"}, while the node for {@code Entry}
* has package qualifier {@code null}. Note that the
* {@linkplain JClassSymbol#getPackageName() package name}
* of the symbol and type mirror will reflect that package
* name anyway, on both nodes.
*/
public @Nullable String getPackageQualifier() {
if (isFullyQualified()) {
assert symbol != null : "Symbol should be non-null if isFullyQualified returns true";
return symbol.getPackageName();
}
return null;
}
@Override
protected <P, R> R acceptVisitor(JavaVisitor<? super P, ? extends R> visitor, P data) {
return visitor.visit(this, data);
@@ -13,7 +13,6 @@ import net.sourceforge.pmd.annotation.Experimental;
import net.sourceforge.pmd.lang.ast.AstInfo;
import net.sourceforge.pmd.lang.ast.NodeStream;
import net.sourceforge.pmd.lang.ast.RootNode;
import net.sourceforge.pmd.lang.ast.impl.GenericNode;
import net.sourceforge.pmd.lang.java.symbols.table.JSymbolTable;
import net.sourceforge.pmd.lang.java.types.TypeSystem;
import net.sourceforge.pmd.lang.java.types.ast.internal.LazyTypeResolver;
@@ -49,7 +48,7 @@ import net.sourceforge.pmd.lang.rule.xpath.NoAttribute;
* @see <a href="https://openjdk.org/jeps/445">JEP 445: Unnamed Classes and Instance Main Methods (Preview)</a> (Java 21)
* @see #isUnnamedClass()
*/
public final class ASTCompilationUnit extends AbstractJavaNode implements JavaNode, GenericNode<JavaNode>, RootNode {
public final class ASTCompilationUnit extends AbstractJavaNode implements RootNode {
private LazyTypeResolver lazyTypeResolver;
private List<JavaComment> comments;
@@ -22,11 +22,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
*
* </pre>
*/
public final class ASTConstructorCall extends AbstractInvocationExpr
implements ASTPrimaryExpression,
QualifiableExpression,
LeftRecursiveNode,
InvocationNode {
public final class ASTConstructorCall extends AbstractInvocationExpr implements QualifiableExpression, LeftRecursiveNode {
ASTConstructorCall(int id) {
super(id);
@@ -19,9 +19,8 @@ import net.sourceforge.pmd.lang.java.types.OverloadSelectionResult;
* </pre>
*/
public final class ASTEnumConstant extends AbstractJavaTypeNode
implements Annotatable,
InvocationNode,
ModifierOwner,
implements InvocationNode,
ModifierOwner,
ASTBodyDeclaration,
InternalInterfaces.VariableIdOwner,
JavadocCommentOwner {
@@ -7,7 +7,6 @@ package net.sourceforge.pmd.lang.java.ast;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import net.sourceforge.pmd.lang.ast.impl.GenericNode;
import net.sourceforge.pmd.lang.java.symbols.JExecutableSymbol;
import net.sourceforge.pmd.lang.java.types.JClassType;
import net.sourceforge.pmd.lang.java.types.JMethodSig;
@@ -32,7 +31,6 @@ public interface ASTExecutableDeclaration
extends ModifierOwner,
ASTBodyDeclaration,
TypeParamOwnerNode,
GenericNode<JavaNode>,
JavadocCommentOwner {
@@ -39,11 +39,7 @@ import net.sourceforge.pmd.lang.java.types.ast.ExprContext;
*
* </pre>
*/
public interface ASTExpression
extends JavaNode,
TypeNode,
ASTMemberValue,
ASTSwitchArrowRHS {
public interface ASTExpression extends TypeNode, ASTMemberValue, ASTSwitchArrowRHS {
/**
* Always returns true. This is to allow XPath queries
@@ -22,9 +22,7 @@ import net.sourceforge.pmd.lang.rule.xpath.DeprecatedAttribute;
* </pre>
*/
public final class ASTFieldDeclaration extends AbstractJavaNode
implements Iterable<ASTVariableId>,
LeftRecursiveNode,
ModifierOwner,
implements LeftRecursiveNode,
ASTBodyDeclaration,
InternalInterfaces.MultiVariableIdOwner,
JavadocCommentOwner {
@@ -25,10 +25,7 @@ import net.sourceforge.pmd.lang.java.types.TypingContext;
* </pre>
*/
public final class ASTFormalParameter extends AbstractJavaNode
implements ModifierOwner,
TypeNode,
Annotatable,
VariableIdOwner {
implements ModifierOwner, TypeNode, VariableIdOwner {
ASTFormalParameter(int id) {
super(id);
@@ -25,9 +25,7 @@ import net.sourceforge.pmd.lang.document.FileLocation;
*/
// TODO extend AbstractStatement
public final class ASTLocalVariableDeclaration extends AbstractJavaNode
implements Iterable<ASTVariableId>,
ASTStatement,
ModifierOwner,
implements ASTStatement,
LeftRecursiveNode, // ModifierList is parsed separately in BlockStatement
InternalInterfaces.MultiVariableIdOwner {
@@ -19,11 +19,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
*
* </pre>
*/
public final class ASTMethodCall extends AbstractInvocationExpr
implements ASTPrimaryExpression,
QualifiableExpression,
InvocationNode,
MethodUsage {
public final class ASTMethodCall extends AbstractInvocationExpr implements QualifiableExpression {
ASTMethodCall(int id) {
super(id);
@@ -23,8 +23,7 @@ import net.sourceforge.pmd.lang.java.types.TypeSystem;
* </pre>
*/
public final class ASTMethodReference extends AbstractJavaExpr
implements ASTPrimaryExpression,
QualifiableExpression,
implements QualifiableExpression,
LeftRecursiveNode,
MethodUsage,
FunctionalExpression {
@@ -15,7 +15,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
*
* </pre>
*/
public final class ASTNullLiteral extends AbstractLiteral implements ASTLiteral {
public final class ASTNullLiteral extends AbstractLiteral {
ASTNullLiteral(int id) {
super(id);
}
@@ -14,7 +14,7 @@ import net.sourceforge.pmd.lang.java.types.JPrimitiveType;
/**
* A numeric literal of any type (double, int, long, float, etc).
*/
public final class ASTNumericLiteral extends AbstractLiteral implements ASTLiteral {
public final class ASTNumericLiteral extends AbstractLiteral {
/**
* True if this is an integral literal, ie int OR long,
@@ -120,10 +120,10 @@ public final class ASTNumericLiteral extends AbstractLiteral implements ASTLiter
* for the literal {@code 0} (which can really be any base).
*/
public int getBase() {
return getBase(getLiteralText());
return getBase(getLiteralText(), isIntegral());
}
static int getBase(Chars image) {
static int getBase(Chars image, boolean isIntegral) {
if (image.length() > 1 && image.charAt(0) == '0') {
switch (image.charAt(1)) {
case 'x':
@@ -132,10 +132,8 @@ public final class ASTNumericLiteral extends AbstractLiteral implements ASTLiter
case 'b':
case 'B':
return 2;
case '.':
return 10;
default:
return 8;
return isIntegral ? 8 : 10;
}
}
return 10;
@@ -172,7 +170,7 @@ public final class ASTNumericLiteral extends AbstractLiteral implements ASTLiter
* <p>Invalid literals or overflows result in {@code 0L}.
*/
static long parseIntegralValue(Chars image) {
final int base = getBase(image);
final int base = getBase(image, true);
if (base == 8) {
image = image.subSequence(1); // 0
} else if (base != 10) {
@@ -6,7 +6,6 @@
package net.sourceforge.pmd.lang.java.ast;
import net.sourceforge.pmd.lang.java.ast.ASTList.ASTMaybeEmptyListOf;
import net.sourceforge.pmd.lang.java.ast.InternalInterfaces.AllChildrenAreOfType;
import net.sourceforge.pmd.lang.java.symbols.JConstructorSymbol;
/**
@@ -18,8 +17,7 @@ import net.sourceforge.pmd.lang.java.symbols.JConstructorSymbol;
*
* </pre>
*/
public final class ASTRecordComponentList extends ASTMaybeEmptyListOf<ASTRecordComponent>
implements SymbolDeclaratorNode, AllChildrenAreOfType<ASTRecordComponent> {
public final class ASTRecordComponentList extends ASTMaybeEmptyListOf<ASTRecordComponent> implements SymbolDeclaratorNode {
private JConstructorSymbol symbol;
@@ -18,7 +18,7 @@ import net.sourceforge.pmd.util.StringUtil;
* in the source ({@link #getLiteralText()}). {@link #getConstValue()} allows to recover
* the actual runtime value, by processing escapes.
*/
public final class ASTStringLiteral extends AbstractLiteral implements ASTLiteral {
public final class ASTStringLiteral extends AbstractLiteral {
private static final String TEXTBLOCK_DELIMITER = "\"\"\"";
@@ -18,9 +18,7 @@ import net.sourceforge.pmd.lang.ast.NodeStream;
*
* <p>Their syntax is identical though, and described on {@link ASTSwitchLike}.
*/
public final class ASTSwitchExpression extends AbstractJavaExpr
implements ASTExpression,
ASTSwitchLike {
public final class ASTSwitchExpression extends AbstractJavaExpr implements ASTSwitchLike {
ASTSwitchExpression(int id) {
super(id);
@@ -43,7 +43,7 @@ import net.sourceforge.pmd.lang.java.types.JTypeMirror;
* <p>Note: This node has been called ASTVariableDeclaratorId in PMD 6.
*/
// @formatter:on
public final class ASTVariableId extends AbstractTypedSymbolDeclarator<JVariableSymbol> implements ModifierOwner, SymbolDeclaratorNode {
public final class ASTVariableId extends AbstractTypedSymbolDeclarator<JVariableSymbol> implements ModifierOwner {
private String name;
private List<ASTNamedReferenceExpr> usages = Collections.emptyList();
@@ -127,6 +127,17 @@ public final class ASTVariableId extends AbstractTypedSymbolDeclarator<JVariable
return (ModifierOwner) parent;
}
/**
* Return true if this variable has no name. The name is then equal to {@code "_"}.
* A variable declaration with this name does not actually declare a variable in
* the current scope, since Java 22. In Java 9 to 21, the identifier {@code _} is
* restricted and cannot be used to name a variable. Before Java 9, it is a regular
* identifier.
*/
public boolean isUnnamed() {
return "_".equals(name) && getLanguageVersion().compareToVersion("21-preview") >= 0;
}
/** Returns the name of the variable. */
public String getName() {
return name;
Loaded 30 of 128 files, more files were not shown because too many files have changed in this diff. Show more