Skip to content

Commit 36fb18b

Browse files
committed
Merge tag 'javaparser-parent-3.25.10'
# By renovate[bot] (28) and others # Via GitHub (29) and jlerbsc (1) * tag 'javaparser-parent-3.25.10': (65 commits) [maven-release-plugin] prepare release javaparser-parent-3.25.10 update readme Update changelog chore(deps): update codecov/codecov-action action to v4.2.0 fix: issue 4358 prevent infinite cycles with static imports chore(deps): update dependency org.jacoco:jacoco-maven-plugin to v0.8.12 Resolve compilation error on StringProvider Fix issue 4345 Strange error when trying to find erasure of generic type where one of two type parameters is an array chore(deps): update dependency com.puppycrawl.tools:checkstyle to v10.15.0 fix(deps): update byte-buddy.version to v1.14.13 chore(deps): update codecov/codecov-action action to v4.1.1 chore(deps): update dependency org.apache.maven.plugins:maven-gpg-plugin to v3.2.2 Refactor ResolvedReferenceType#equals chore(deps): update dependency org.apache.maven.plugins:maven-compiler-plugin to v3.13.0 chore(deps): update dependency org.apache.maven.plugins:maven-gpg-plugin to v3.2.1 chore(deps): update dependency com.puppycrawl.tools:checkstyle to v10.14.2 fix(deps): update dependency com.google.guava:guava to v33.1.0-jre chore(deps): bump actions/checkout from 4.1.1 to 4.1.2 chore(deps): update dependency com.puppycrawl.tools:checkstyle to v10.14.1 chore(deps): update dependency org.apache.maven.plugins:maven-gpg-plugin to v3.2.0 ... # Conflicts: # .github/workflows/maven_tests.yml # javaparser-core-generators/pom.xml # javaparser-core-metamodel-generator/pom.xml # javaparser-core-serialization/pom.xml # javaparser-core-testing-bdd/pom.xml # javaparser-core-testing/pom.xml # javaparser-core-testing/src/test/java/com/github/javaparser/remove/NodeRemovalTest.java # javaparser-core/pom.xml # javaparser-core/src/main/java/com/github/javaparser/HasParentNode.java # javaparser-core/src/main/java/com/github/javaparser/ast/body/MethodDeclaration.java # javaparser-core/src/main/java/com/github/javaparser/ast/expr/LambdaExpr.java # javaparser-core/src/main/java/com/github/javaparser/ast/validator/postprocessors/Java10PostProcessor.java # javaparser-core/src/main/java/com/github/javaparser/ast/visitor/CloneVisitor.java # javaparser-core/src/main/java/com/github/javaparser/printer/lexicalpreservation/Difference.java # javaparser-core/src/main/java/com/github/javaparser/printer/lexicalpreservation/LexicalPreservingPrinter.java # javaparser-core/src/main/java/com/github/javaparser/printer/lexicalpreservation/changes/ListRemovalChange.java # javaparser-core/src/main/java/com/github/javaparser/resolution/declarations/ResolvedReferenceTypeDeclaration.java # javaparser-core/src/main/java/com/github/javaparser/resolution/logic/MethodResolutionLogic.java # javaparser-core/src/main/java/com/github/javaparser/resolution/types/ResolvedReferenceType.java # javaparser-core/src/main/java/com/github/javaparser/utils/Utils.java # javaparser-symbol-solver-core/pom.xml # javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javaparsermodel/contexts/MethodReferenceExprContext.java # javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/reflectionmodel/ReflectionEnumDeclaration.java # javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/constraintformulas/ExpressionCompatibleWithType.java # javaparser-symbol-solver-testing/pom.xml # javaparser-symbol-solver-testing/src/test/java/com/github/javaparser/symbolsolver/javaparsermodel/contexts/JavaParserTypeDeclarationAdapterTest.java # javaparser-symbol-solver-testing/src/test/java/com/github/javaparser/symbolsolver/model/typesystem/ReferenceTypeTest.java # pom.xml # readme.md
2 parents 7ac2033 + 3492371 commit 36fb18b

File tree

63 files changed

+1111
-584
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1111
-584
lines changed

.github/workflows/create_github_release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout code
18-
uses: actions/[email protected].1
18+
uses: actions/[email protected].2
1919

2020
- name: Create Release
2121
id: create_release

.github/workflows/prepare_release_changelog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
# Check out current repository
1919
- name: Fetch Sources
20-
uses: actions/[email protected].1
20+
uses: actions/[email protected].2
2121

2222
# Setup Java 11 environment for the next steps
2323
- name: Setup Java

changelog.md

Lines changed: 94 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
2-
Next Release (Version 3.25.9-snapshot)
1+
Next Release (Version 3.25.11-snapshot)
32
--------------------------------------
4-
[issues resolved](https://github.com/javaparser/javaparser/milestone/205?closed=1)
3+
[issues resolved](https://github.com/javaparser/javaparser/milestone/207?closed=1)
54

65
### Added
76
### Changed
@@ -10,6 +9,98 @@ Next Release (Version 3.25.9-snapshot)
109
### Fixed
1110
### Security
1211

12+
Version 3.25.10
13+
---------------
14+
[issues resolved](https://github.com/javaparser/javaparser/milestone/206?closed=1)
15+
16+
### Fixed
17+
18+
* Fix issue 4345 Strange error when trying to find erasure of generic t… (
19+
PR [#4362](https://github.com/javaparser/javaparser/pull/4362) by [@jlerbsc](https://github.com/jlerbsc))
20+
* fix: issue 4358 prevent infinite cycles with static imports (
21+
PR [#4359](https://github.com/javaparser/javaparser/pull/4359) by [@kdunee](https://github.com/kdunee))
22+
* Refactor `ResolvedReferenceType#equals` (PR [#4351](https://github.com/javaparser/javaparser/pull/4351)
23+
by [@freya022](https://github.com/freya022))
24+
* fix: issue 4331 Cannot be 'abstract' and also 'private'. for a private method in an interface (
25+
PR [#4332](https://github.com/javaparser/javaparser/pull/4332) by [@jlerbsc](https://github.com/jlerbsc))
26+
27+
### Developer Changes
28+
29+
* chore(deps): bump actions/checkout from 4.1.1 to 4.1.2 (PR [#4341](https://github.com/javaparser/javaparser/pull/4341)
30+
by [@dependabot[bot]](https://github.com/apps/dependabot))
31+
32+
### :heart: Contributors
33+
34+
Thank You to all contributors who worked on this release!
35+
36+
* [@kdunee](https://github.com/kdunee)
37+
* [@freya022](https://github.com/freya022)
38+
* [@jlerbsc](https://github.com/jlerbsc)
39+
40+
Version 3.25.9
41+
--------------
42+
[issues resolved](https://github.com/javaparser/javaparser/milestone/205?closed=1)
43+
44+
### Added
45+
46+
* Fix: issue #3878 resolve MethodReference in ObjectCreationExpr (
47+
PR [#4296](https://github.com/javaparser/javaparser/pull/4296) by [@fishautumn](https://github.com/fishautumn))
48+
49+
### Changed
50+
51+
* Switch order of literals to prevent NullPointerException (
52+
PR [#4322](https://github.com/javaparser/javaparser/pull/4322) by [@citizenjosh](https://github.com/citizenjosh))
53+
* Minor refactoring to use the existing getArgumentPosition method (
54+
PR [#4306](https://github.com/javaparser/javaparser/pull/4306) by [@jlerbsc](https://github.com/jlerbsc))
55+
* Optimize find ancestor (PR [#4294](https://github.com/javaparser/javaparser/pull/4294)
56+
by [@magicwerk](https://github.com/magicwerk))
57+
* refac: Removes useless ExpressionHelper utility class and replaces some explicit casts by using the javaparser API (
58+
PR [#4291](https://github.com/javaparser/javaparser/pull/4291) by [@jlerbsc](https://github.com/jlerbsc))
59+
60+
### Fixed
61+
62+
* fix: Dead stores should be removed (sonar rule) (PR [#4329](https://github.com/javaparser/javaparser/pull/4329)
63+
by [@jlerbsc](https://github.com/jlerbsc))
64+
* fix: Replace this if-then-else statement by a single return statement (sonar rule) (
65+
PR [#4328](https://github.com/javaparser/javaparser/pull/4328) by [@jlerbsc](https://github.com/jlerbsc))
66+
* fix: issue 2043 getAccessSpecifier should return public for interface methods (
67+
PR [#4317](https://github.com/javaparser/javaparser/pull/4317) by [@jlerbsc](https://github.com/jlerbsc))
68+
* Further improve correction of whitespace during difference application (
69+
PR [#4316](https://github.com/javaparser/javaparser/pull/4316) by [@jlerbsc](https://github.com/jlerbsc))
70+
* Fix: issue #3946 Symbol solver is unable to resolve inherited inner classes (
71+
PR [#4314](https://github.com/javaparser/javaparser/pull/4314) by [@jlerbsc](https://github.com/jlerbsc))
72+
* fix: issue 4311 IllegalStateException when removing all comments with LexicalPreservingPrinter (
73+
PR [#4313](https://github.com/javaparser/javaparser/pull/4313) by [@jlerbsc](https://github.com/jlerbsc))
74+
* Fix: issue 3939 SymbolResolver.calculateType(Expression) may fails on first try, then succeed on later tries (
75+
PR [#4290](https://github.com/javaparser/javaparser/pull/4290) by [@jlerbsc](https://github.com/jlerbsc))
76+
* Adds unit test for issue 4284 "ClassCastException when resolving MethodCallExpr inside an enhanced switch statement" (
77+
PR [#4285](https://github.com/javaparser/javaparser/pull/4285) by [@jlerbsc](https://github.com/jlerbsc))
78+
* Change `SwitchStmt` to `SwitchNode` in `SwitchEntryContext` to avoid `ClassCastException` (
79+
PR [#4283](https://github.com/javaparser/javaparser/pull/4283)
80+
by [@PalashSharma20](https://github.com/PalashSharma20))
81+
82+
### Developer Changes
83+
84+
* chore(deps): bump org.codehaus.mojo:exec-maven-plugin from 3.1.1 to 3.2.0 (
85+
PR [#4323](https://github.com/javaparser/javaparser/pull/4323)
86+
by [@dependabot[bot]](https://github.com/apps/dependabot))
87+
* chore(deps): update junit5 monorepo to v5.10.2 (PR [#4307](https://github.com/javaparser/javaparser/pull/4307)
88+
by [@renovate[bot]](https://github.com/apps/renovate))
89+
* chore(deps): update codecov/codecov-action action to v4 (
90+
PR [#4304](https://github.com/javaparser/javaparser/pull/4304) by [@renovate[bot]](https://github.com/apps/renovate))
91+
* chore(deps): update actions/cache action to v4 (PR [#4293](https://github.com/javaparser/javaparser/pull/4293)
92+
by [@renovate[bot]](https://github.com/apps/renovate))
93+
94+
### :heart: Contributors
95+
96+
Thank You to all contributors who worked on this release!
97+
98+
* [@citizenjosh](https://github.com/citizenjosh)
99+
* [@magicwerk](https://github.com/magicwerk)
100+
* [@PalashSharma20](https://github.com/PalashSharma20)
101+
* [@jlerbsc](https://github.com/jlerbsc)
102+
* [@fishautumn](https://github.com/fishautumn)
103+
13104
Version 3.25.8
14105
--------------
15106
[issues resolved](https://github.com/javaparser/javaparser/milestone/204?closed=1)

javaparser-core-generators/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<artifactId>jmlparser-parent</artifactId>
66
<groupId>io.github.jmltoolkit</groupId>
7-
<version>3.25.8-SNAPSHOT</version>
7+
<version>3.25.10-SNAPSHOT</version>
88
</parent>
99
<modelVersion>4.0.0</modelVersion>
1010

javaparser-core-generators/src/main/java/com/github/javaparser/generator/VisitorGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ protected void after() throws Exception {
7979

8080
private void generateVisitMethodForNode(BaseNodeMetaModel node, ClassOrInterfaceDeclaration visitorClass, CompilationUnit compilationUnit) {
8181
final Optional<MethodDeclaration> existingVisitMethod = visitorClass.getMethods().stream()
82-
.filter(m -> m.getNameAsString().equals("visit"))
82+
.filter(m -> "visit".equals(m.getNameAsString()))
8383
.filter(m -> m.getParameter(0).getType().toString().equals(node.getTypeName()))
8484
.findFirst();
8585

javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/other/TokenKindGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void generate() {
5353

5454
final CompilationUnit javaTokenCu = sourceRoot.parse("com.github.javaparser", "JavaToken.java");
5555
final ClassOrInterfaceDeclaration javaToken = javaTokenCu.getClassByName("JavaToken").orElseThrow(() -> new AssertionError("Can't find class in java file."));
56-
final EnumDeclaration kindEnum = javaToken.findFirst(EnumDeclaration.class, e -> e.getNameAsString().equals("Kind")).orElseThrow(() -> new AssertionError("Can't find class in java file."));
56+
final EnumDeclaration kindEnum = javaToken.findFirst(EnumDeclaration.class, e -> "Kind".equals(e.getNameAsString())).orElseThrow(() -> new AssertionError("Can't find class in java file."));
5757

5858
kindEnum.getEntries().clear();
5959
annotateGenerated(kindEnum);

javaparser-core-generators/src/main/java/com/github/javaparser/generator/core/visitor/CloneVisitorGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected void generateVisitMethodBody(BaseNodeMetaModel node, MethodDeclaration
6464
SeparatedItemStringBuilder builder = new SeparatedItemStringBuilder(f("%s r = new %s(", node.getTypeNameGenerified(), node.getTypeNameGenerified()), ",", ");");
6565
builder.append("n.getTokenRange().orElse(null)");
6666
for (PropertyMetaModel field : node.getConstructorParameters()) {
67-
if (field.getName().equals("comment")) {
67+
if ("comment".equals(field.getName())) {
6868
continue;
6969
}
7070
if (field.getNodeReference().isPresent()) {

javaparser-core-metamodel-generator/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<artifactId>jmlparser-parent</artifactId>
66
<groupId>io.github.jmltoolkit</groupId>
7-
<version>3.25.8-SNAPSHOT</version>
7+
<version>3.25.10-SNAPSHOT</version>
88
</parent>
99
<modelVersion>4.0.0</modelVersion>
1010

javaparser-core-serialization/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<artifactId>jmlparser-parent</artifactId>
55
<groupId>io.github.jmltoolkit</groupId>
6-
<version>3.25.8-SNAPSHOT</version>
6+
<version>3.25.10-SNAPSHOT</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99

javaparser-core-testing-bdd/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<artifactId>jmlparser-parent</artifactId>
55
<groupId>io.github.jmltoolkit</groupId>
6-
<version>3.25.8-SNAPSHOT</version>
6+
<version>3.25.10-SNAPSHOT</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99

javaparser-core-testing/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<artifactId>jmlparser-parent</artifactId>
55
<groupId>io.github.jmltoolkit</groupId>
6-
<version>3.25.8-SNAPSHOT</version>
6+
<version>3.25.10-SNAPSHOT</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99

@@ -128,7 +128,7 @@
128128
<dependency>
129129
<groupId>org.assertj</groupId>
130130
<artifactId>assertj-core</artifactId>
131-
<version>3.25.0</version>
131+
<version>3.25.3</version>
132132
<scope>test</scope>
133133
</dependency>
134134
<dependency>

javaparser-core-testing/src/test/java/com/github/javaparser/ast/body/MethodDeclarationTest.java

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,16 @@
2121

2222
package com.github.javaparser.ast.body;
2323

24+
import static com.github.javaparser.StaticJavaParser.parse;
25+
import static com.github.javaparser.StaticJavaParser.parseBodyDeclaration;
26+
import static org.junit.jupiter.api.Assertions.assertEquals;
27+
import static org.junit.jupiter.api.Assertions.assertFalse;
28+
import static org.junit.jupiter.api.Assertions.assertNotEquals;
29+
import static org.junit.jupiter.api.Assertions.assertTrue;
30+
2431
import org.junit.jupiter.api.Test;
2532

26-
import static com.github.javaparser.StaticJavaParser.parseBodyDeclaration;
27-
import static org.junit.jupiter.api.Assertions.*;
33+
import com.github.javaparser.ast.CompilationUnit;
2834

2935
class MethodDeclarationTest {
3036
@Test
@@ -118,4 +124,39 @@ void isFixedArityMethod() {
118124
MethodDeclaration method2 = parseBodyDeclaration("int x();").asMethodDeclaration();
119125
assertTrue(method2.isFixedArityMethod());
120126
}
127+
128+
/*
129+
* A method in the body of an interface may be declared public or private
130+
* (§6.6). If no access modifier is given, the method is implicitly public.
131+
* https://docs.oracle.com/javase/specs/jls/se9/html/jls-9.html#jls-9.4
132+
*/
133+
@Test
134+
void isMethodInterfaceImplictlyPublic() {
135+
CompilationUnit cu = parse("interface Foo { void m(); }");
136+
assertTrue(cu.findFirst(MethodDeclaration.class).get().isPublic());
137+
cu = parse("interface Foo { public void m(); }");
138+
assertTrue(cu.findFirst(MethodDeclaration.class).get().isPublic());
139+
cu = parse("interface Foo { abstract void m(); }");
140+
assertTrue(cu.findFirst(MethodDeclaration.class).get().isPublic());
141+
cu = parse("interface Foo { private void m(); }");
142+
assertFalse(cu.findFirst(MethodDeclaration.class).get().isPublic());
143+
}
144+
145+
/*
146+
* An interface method lacking a private, default, or static modifier is implicitly abstract.
147+
* https://docs.oracle.com/javase/specs/jls/se9/html/jls-9.html#jls-9.4
148+
*/
149+
@Test
150+
void isMethodInterfaceImplictlyAbstract() {
151+
CompilationUnit cu = parse("interface Foo { void m(); }");
152+
assertTrue(cu.findFirst(MethodDeclaration.class).get().isAbstract());
153+
cu = parse("interface Foo { abstract void m(); }");
154+
assertTrue(cu.findFirst(MethodDeclaration.class).get().isAbstract());
155+
cu = parse("interface Foo { private void m(); }");
156+
assertFalse(cu.findFirst(MethodDeclaration.class).get().isAbstract());
157+
cu = parse("interface Foo { static void m(); }");
158+
assertFalse(cu.findFirst(MethodDeclaration.class).get().isAbstract());
159+
cu = parse("interface Foo { default void m(){} }");
160+
assertFalse(cu.findFirst(MethodDeclaration.class).get().isAbstract());
161+
}
121162
}

javaparser-core-testing/src/test/java/com/github/javaparser/printer/lexicalpreservation/LexicalPreservingPrinterTest.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@
2626
import static com.github.javaparser.printer.lexicalpreservation.LexicalPreservingPrinter.NODE_TEXT_DATA;
2727
import static com.github.javaparser.utils.TestUtils.assertEqualsStringIgnoringEol;
2828
import static com.github.javaparser.utils.Utils.SYSTEM_EOL;
29-
import static org.junit.jupiter.api.Assertions.*;
29+
import static org.junit.jupiter.api.Assertions.assertEquals;
30+
import static org.junit.jupiter.api.Assertions.assertFalse;
31+
import static org.junit.jupiter.api.Assertions.assertTrue;
32+
import static org.junit.jupiter.api.Assertions.fail;
3033

3134
import java.io.IOException;
3235
import java.util.Arrays;
@@ -1702,6 +1705,24 @@ void removedIndentationLineCommentsPrinted() {
17021705
assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu));
17031706
}
17041707

1708+
// issue 4311 IllegalStateException when removing all comments with LexicalPreservingPrinter
1709+
@Test
1710+
void removedLineCommentsWithSameContent() {
1711+
considerCode("public class Foo {\n" +
1712+
" //line 1 \n" +
1713+
" //line 1 \n" +
1714+
" void mymethod() {\n" +
1715+
" }\n" +
1716+
"}");
1717+
String expected =
1718+
"public class Foo {\n" +
1719+
" void mymethod() {\n" +
1720+
" }\n" +
1721+
"}";
1722+
cu.getAllContainedComments().stream().forEach(c -> c.remove());
1723+
assertEqualsStringIgnoringEol(expected, LexicalPreservingPrinter.print(cu));
1724+
}
1725+
17051726
// issue 3216 LexicalPreservingPrinter add Wrong indentation when removing comments
17061727
@Test
17071728
void removedIndentationBlockCommentsPrinted() {

0 commit comments

Comments
 (0)