diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 7d4f179565..00f3c37a3e 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -29,3 +29,4 @@ Our development workflow is based on Pull Request. If you are not familiar with
- Pull requests often stay open for at least a few days to give people a chance to review it.
- A pull request is merged when all comments on it have been resolved.
- If you create a pull request for an issue, mention the issue in the format #123 to make github link it automatically.
+- Before submitting a pull request, please run `./mvnw spotless:apply` to format your code to avoid any formatting related issues during review.
diff --git a/changelog.md b/changelog.md
index cbaf507083..7f5923dd48 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,7 +1,7 @@
-Next Release (Version 3.26.1-snapshot)
+Next Release (Version 3.26.2-snapshot)
--------------------------------------
-[issues resolved](https://github.com/javaparser/javaparser/milestone/208?closed=1)
+[issues resolved](https://github.com/javaparser/javaparser/milestone/209?closed=1)
### Added
### Changed
@@ -10,9 +10,48 @@ Next Release (Version 3.26.1-snapshot)
### Fixed
### Security
+Version 3.26.1
+--------------
+[issues resolved](https://github.com/javaparser/javaparser/milestone/208?closed=1)
+
+### Added
+
+* Fix record declarations nested in annotation declarations (PR [#4460](https://github.com/javaparser/javaparser/pull/4460) by [@johannescoetzee](https://github.com/johannescoetzee))
+
+### Changed
+
+* Format code with spotless (PR [#4465](https://github.com/javaparser/javaparser/pull/4465) by [@johannescoetzee](https://github.com/johannescoetzee))
+* Simplifying the search for types in compilation unit (PR [#4459](https://github.com/javaparser/javaparser/pull/4459) by [@jlerbsc](https://github.com/jlerbsc))
+* Add spotless plugin configuration (PR [#4409](https://github.com/javaparser/javaparser/pull/4409) by [@johannescoetzee](https://github.com/johannescoetzee))
+
+### Fixed
+
+* Disable spotless ratcheting and fix formatting (PR [#4478](https://github.com/javaparser/javaparser/pull/4478) by [@johannescoetzee](https://github.com/johannescoetzee))
+* Fix: issue 4450 Endless recursion (-> StackOverflow) with cyclic static references (PR [#4477](https://github.com/javaparser/javaparser/pull/4477) by [@jlerbsc](https://github.com/jlerbsc))
+* Fix: issue 4399 MethodCallExpr inside lambda in assignment expression cannot be resolved (PR [#4462](https://github.com/javaparser/javaparser/pull/4462) by [@jlerbsc](https://github.com/jlerbsc))
+* Fix crash on SwitchExpr entries if tokens are not stored (PR [#4461](https://github.com/javaparser/javaparser/pull/4461) by [@johannescoetzee](https://github.com/johannescoetzee))
+* Fix lookahead for pattern expression in switch entries [Issue 4455] (PR [#4458](https://github.com/javaparser/javaparser/pull/4458) by [@johannescoetzee](https://github.com/johannescoetzee))
+
+### Developer Changes
+
+* Automatically format code after codegen and validate with a github action (PR [#4468](https://github.com/javaparser/javaparser/pull/4468) by [@johannescoetzee](https://github.com/johannescoetzee))
+* Add git-blame-ignore-revs file to ignore the reformatting commit in git blame (PR [#4466](https://github.com/javaparser/javaparser/pull/4466) by [@johannescoetzee](https://github.com/johannescoetzee))
+
+### Uncategorised
+
+* Add link to the guide to adding nodes in CONTRIBUTING.md (PR [#4453](https://github.com/javaparser/javaparser/pull/4453) by [@johannescoetzee](https://github.com/johannescoetzee))
+
+### :heart: Contributors
+
+Thank You to all contributors who worked on this release!
+
+* [@johannescoetzee](https://github.com/johannescoetzee)
+* [@jlerbsc](https://github.com/jlerbsc)
-Next Release (Version 3.26.0)
------------------------------
+
+
+Version 3.26.0
+--------------
[issues resolved](https://github.com/javaparser/javaparser/milestone/207?closed=1)
### Added
diff --git a/javaparser-core-generators/pom.xml b/javaparser-core-generators/pom.xml
index 604dadd5fc..3b88373a5d 100644
--- a/javaparser-core-generators/pom.xml
+++ b/javaparser-core-generators/pom.xml
@@ -3,7 +3,7 @@
javaparser-parent
com.github.javaparser
- 3.26.1-SNAPSHOT
+ 3.26.1
4.0.0
diff --git a/javaparser-core-metamodel-generator/pom.xml b/javaparser-core-metamodel-generator/pom.xml
index a744d49d67..91fedc0f21 100644
--- a/javaparser-core-metamodel-generator/pom.xml
+++ b/javaparser-core-metamodel-generator/pom.xml
@@ -3,7 +3,7 @@
javaparser-parent
com.github.javaparser
- 3.26.1-SNAPSHOT
+ 3.26.1
4.0.0
diff --git a/javaparser-core-serialization/pom.xml b/javaparser-core-serialization/pom.xml
index ae2489da78..5a1e397aed 100644
--- a/javaparser-core-serialization/pom.xml
+++ b/javaparser-core-serialization/pom.xml
@@ -2,7 +2,7 @@
javaparser-parent
com.github.javaparser
- 3.26.1-SNAPSHOT
+ 3.26.1
4.0.0
diff --git a/javaparser-core-testing-bdd/pom.xml b/javaparser-core-testing-bdd/pom.xml
index 9c35614477..487bcbe9e4 100644
--- a/javaparser-core-testing-bdd/pom.xml
+++ b/javaparser-core-testing-bdd/pom.xml
@@ -2,7 +2,7 @@
javaparser-parent
com.github.javaparser
- 3.26.1-SNAPSHOT
+ 3.26.1
4.0.0
diff --git a/javaparser-core-testing/pom.xml b/javaparser-core-testing/pom.xml
index 5cf1acc9f7..e0ee736e8b 100644
--- a/javaparser-core-testing/pom.xml
+++ b/javaparser-core-testing/pom.xml
@@ -2,7 +2,7 @@
javaparser-parent
com.github.javaparser
- 3.26.1-SNAPSHOT
+ 3.26.1
4.0.0
diff --git a/javaparser-core/pom.xml b/javaparser-core/pom.xml
index eca55fbc33..18c767a37f 100644
--- a/javaparser-core/pom.xml
+++ b/javaparser-core/pom.xml
@@ -2,7 +2,7 @@
javaparser-parent
com.github.javaparser
- 3.26.1-SNAPSHOT
+ 3.26.1
4.0.0
diff --git a/javaparser-symbol-solver-core/pom.xml b/javaparser-symbol-solver-core/pom.xml
index dbd7956065..daba4fb045 100644
--- a/javaparser-symbol-solver-core/pom.xml
+++ b/javaparser-symbol-solver-core/pom.xml
@@ -3,7 +3,7 @@
javaparser-parent
com.github.javaparser
- 3.26.1-SNAPSHOT
+ 3.26.1
4.0.0
diff --git a/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javaparsermodel/contexts/CompilationUnitContext.java b/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javaparsermodel/contexts/CompilationUnitContext.java
index e36d2faa2d..d508c2bd86 100644
--- a/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javaparsermodel/contexts/CompilationUnitContext.java
+++ b/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javaparsermodel/contexts/CompilationUnitContext.java
@@ -21,11 +21,6 @@
package com.github.javaparser.symbolsolver.javaparsermodel.contexts;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.stream.Collectors;
-
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.ImportDeclaration;
import com.github.javaparser.ast.Node;
@@ -41,6 +36,10 @@
import com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserClassDeclaration;
import com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserInterfaceDeclaration;
import com.github.javaparser.symbolsolver.resolution.SymbolSolver;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.stream.Collectors;
/**
* @author Federico Tomassetti
@@ -49,11 +48,12 @@ public class CompilationUnitContext extends AbstractJavaParserContext> resolvedStaticImport = ThreadLocal.withInitial(() -> new ArrayList());
+ // Contains the names of static import declarations with asterisks that have
+ // already been resolved. The aim is to keep a history of name searches for the
+ // same resolution attempt in order to avoid a recursive issue leading to a
+ // stackoverflow exception. See issues 4450 & 2720
+ private static ThreadLocal> resolvedStaticImport =
+ ThreadLocal.withInitial(() -> new ArrayList());
///
/// Static methods
@@ -91,20 +91,20 @@ public SymbolReference extends ResolvedValueDeclaration> solveSymbol(String na
if (importDecl.isStatic()) {
if (importDecl.isAsterisk()) {
String qName = importDecl.getNameAsString();
- // Try to resolve the name in from declarations imported with asterisks only if
- // they have not already been analysed, otherwise this can lead to an infinite
- // loop via circular dependencies.
- if (!isAlreadyResolved(qName)) {
- resolvedStaticImport.get().add(qName);
- ResolvedTypeDeclaration importedType = typeSolver.solveType(qName);
-
- SymbolReference extends ResolvedValueDeclaration> ref = new SymbolSolver(typeSolver)
- .solveSymbolInType(importedType, name);
- if (ref.isSolved()) {
- resolvedStaticImport.remove(); // clear the search history
- return ref;
- }
- }
+ // Try to resolve the name in from declarations imported with asterisks only if
+ // they have not already been analysed, otherwise this can lead to an infinite
+ // loop via circular dependencies.
+ if (!isAlreadyResolved(qName)) {
+ resolvedStaticImport.get().add(qName);
+ ResolvedTypeDeclaration importedType = typeSolver.solveType(qName);
+
+ SymbolReference extends ResolvedValueDeclaration> ref =
+ new SymbolSolver(typeSolver).solveSymbolInType(importedType, name);
+ if (ref.isSolved()) {
+ resolvedStaticImport.remove(); // clear the search history
+ return ref;
+ }
+ }
} else {
String whole = importDecl.getNameAsString();
@@ -120,14 +120,14 @@ public SymbolReference extends ResolvedValueDeclaration> solveSymbol(String na
}
}
- // Clear of the search history because we don't want this context to be reused
- // in another search.
- resolvedStaticImport.remove();
+ // Clear of the search history because we don't want this context to be reused
+ // in another search.
+ resolvedStaticImport.remove();
return SymbolReference.unsolved();
}
private boolean isAlreadyResolved(String qName) {
- return resolvedStaticImport.get().contains(qName);
+ return resolvedStaticImport.get().contains(qName);
}
@Override
@@ -329,12 +329,12 @@ public SymbolReference solveMethod(
return SymbolReference.unsolved();
}
- ResolvedTypeDeclaration ref = typeSolver.solveType(importString);
- SymbolReference method = MethodResolutionLogic.solveMethodInType(ref,
- name, argumentsTypes, true);
- if (method.isSolved()) {
- return method;
- }
+ ResolvedTypeDeclaration ref = typeSolver.solveType(importString);
+ SymbolReference method =
+ MethodResolutionLogic.solveMethodInType(ref, name, argumentsTypes, true);
+ if (method.isSolved()) {
+ return method;
+ }
} else {
String qName = importDecl.getNameAsString();
@@ -396,5 +396,4 @@ private String getMember(String qName) {
String memberName = qName.substring(index + 1);
return memberName;
}
-
}
diff --git a/javaparser-symbol-solver-testing/pom.xml b/javaparser-symbol-solver-testing/pom.xml
index 32c33753ce..6093b12368 100644
--- a/javaparser-symbol-solver-testing/pom.xml
+++ b/javaparser-symbol-solver-testing/pom.xml
@@ -3,7 +3,7 @@
javaparser-parent
com.github.javaparser
- 3.26.1-SNAPSHOT
+ 3.26.1
4.0.0
diff --git a/javaparser-symbol-solver-testing/src/test/java/com/github/javaparser/symbolsolver/Issue4450Test.java b/javaparser-symbol-solver-testing/src/test/java/com/github/javaparser/symbolsolver/Issue4450Test.java
index 15752318a8..a1847c4348 100755
--- a/javaparser-symbol-solver-testing/src/test/java/com/github/javaparser/symbolsolver/Issue4450Test.java
+++ b/javaparser-symbol-solver-testing/src/test/java/com/github/javaparser/symbolsolver/Issue4450Test.java
@@ -21,6 +21,7 @@
package com.github.javaparser.symbolsolver;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+
import com.github.javaparser.ParserConfiguration;
import com.github.javaparser.StaticJavaParser;
import com.github.javaparser.ast.CompilationUnit;
@@ -28,7 +29,6 @@
import com.github.javaparser.symbolsolver.resolution.typesolvers.CombinedTypeSolver;
import com.github.javaparser.symbolsolver.resolution.typesolvers.JavaParserTypeSolver;
import com.github.javaparser.symbolsolver.resolution.typesolvers.ReflectionTypeSolver;
-
import java.io.IOException;
import java.nio.file.Path;
import org.junit.jupiter.api.Test;
@@ -39,23 +39,23 @@ public class Issue4450Test extends AbstractSymbolResolutionTest {
public void test() throws IOException {
ParserConfiguration config = new ParserConfiguration();
Path issueResourcesPath = adaptPath("src/test/resources/issue4450");
- JavaParserTypeSolver jpts = new JavaParserTypeSolver(issueResourcesPath);
+ JavaParserTypeSolver jpts = new JavaParserTypeSolver(issueResourcesPath);
CombinedTypeSolver cts = new CombinedTypeSolver();
cts.add(new ReflectionTypeSolver(false));
cts.add(jpts);
config.setSymbolResolver(new JavaSymbolSolver(cts));
StaticJavaParser.setConfiguration(config);
- StaticJavaParser.setConfiguration(config);
- CompilationUnit cu = StaticJavaParser.parse(issueResourcesPath.resolve("a/RefCycleClass.java"));
+ StaticJavaParser.setConfiguration(config);
+ CompilationUnit cu = StaticJavaParser.parse(issueResourcesPath.resolve("a/RefCycleClass.java"));
- // We shouldn't throw a mismatched symbol
- assertDoesNotThrow(() -> cu.findAll(NameExpr.class).stream()
- .map(NameExpr::resolve)
- .findAny().get());
+ // We shouldn't throw a mismatched symbol
+ assertDoesNotThrow(() -> cu.findAll(NameExpr.class).stream()
+ .map(NameExpr::resolve)
+ .findAny()
+ .get());
- cu.findAll(NameExpr.class).forEach(expr -> {
- expr.resolve().getName();
- });
+ cu.findAll(NameExpr.class).forEach(expr -> {
+ expr.resolve().getName();
+ });
}
-
}
diff --git a/pom.xml b/pom.xml
index adc9fce553..b83f40774b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,7 @@
com.github.javaparser
javaparser-parent
pom
- 3.26.1-SNAPSHOT
+ 3.26.1
javaparser-parent
https://github.com/javaparser
@@ -149,7 +149,7 @@
1.8
1.14.17
-javaagent:'${settings.localRepository}/net/bytebuddy/byte-buddy-agent/${byte-buddy.version}/byte-buddy-agent-${byte-buddy.version}.jar'
- 2024-06-02T00:00:00Z
+ 2024-06-21T00:00:00Z
@@ -346,8 +346,6 @@
2.43.0
-
- origin/master