Skip to content

Commit

Permalink
Merge tag 'javaparser-parent-3.25.3'
Browse files Browse the repository at this point in the history
# By jlerbsc (5) and others
# Via GitHub (7) and jlerbsc (1)
* tag 'javaparser-parent-3.25.3':
  [maven-release-plugin] prepare release javaparser-parent-3.25.3
  update readme
  Update changelog
  Fix: issue 1843 Problems with hasAnnotation() and hasDirectlyAnnotation()
  chore(deps): bump checkstyle from 10.9.3 to 10.10.0
  chore(deps): update junit5 monorepo to v5.9.3
  chore(deps): bump jacoco-maven-plugin from 0.8.9 to 0.8.10
  chore(deps-dev): bump okhttp from 4.10.0 to 4.11.0
  Refact: minor simplification of the Difference class

# Conflicts:
#	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/pom.xml
#	javaparser-core/src/main/java/com/github/javaparser/ast/Node.java
#	javaparser-core/src/main/java/com/github/javaparser/printer/lexicalpreservation/Difference.java
#	javaparser-core/src/main/java/com/github/javaparser/resolution/declarations/ResolvedReferenceTypeDeclaration.java
#	javaparser-symbol-solver-core/pom.xml
#	javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/javassistmodel/JavassistTypeDeclarationAdapter.java
#	javaparser-symbol-solver-testing/pom.xml
#	javaparser-symbol-solver-testing/src/test/java/com/github/javaparser/symbolsolver/resolution/DefaultPackageTest.java
#	pom.xml
#	readme.md
  • Loading branch information
wadoon committed Nov 19, 2023
1 parent c00a600 commit 7ca59d5
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void sealedClass() {
assertFalse(x.isInnerClass());
assertFalse(x.isNestedType());
assertFalse(x.isLocalClassDeclaration());
assertTrue(x.hasModifier(Modifier.Keyword.SEALED));
assertTrue(x.hasModifier(Modifier.DefaultKeyword.SEALED));
assertEquals(x.getPermittedTypes().size(), 2);
assertEquals(x.getPermittedTypes().get(0).getNameAsString(), "Y");
assertEquals(x.getPermittedTypes().get(1).getNameAsString(), "Z");
Expand All @@ -106,7 +106,7 @@ void nonSealedClass() {
assertFalse(x.isInnerClass());
assertFalse(x.isNestedType());
assertFalse(x.isLocalClassDeclaration());
assertTrue(x.hasModifier(Modifier.Keyword.NON_SEALED));
assertTrue(x.hasModifier(Modifier.DefaultKeyword.NON_SEALED));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ public void postProcess(ParseResult<? extends Node> result, ParserConfiguration
if (configuration.isProcessJml()) {
final Optional<? extends Node> r = result.getResult();
final Optional<CommentsCollection> comments = result.getCommentsCollection();
ArrayList<Node> processedJmlDoc = new ArrayList<>(4096);
ArrayList<Node> processedJmlDoc = new ArrayList<>(4096 * 10);
if (r.isPresent() && comments.isPresent()) {
for (List<String> activeKeys : configuration.getJmlKeys()) {
final JmlReplaceVisitor v = new JmlReplaceVisitor(configuration, new TreeSet<>(activeKeys), result.getProblems());
r.get().accept(v, null);
//System.out.format("cap: %d, size: %d, add: %d", 0, processedJmlDoc.size(), v.processedJmlDoc.size());
processedJmlDoc.addAll(v.processedJmlDoc);
}
}
Expand Down
2 changes: 1 addition & 1 deletion jmlparser-jml-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<artifactId>jmlparser-parent</artifactId>
<groupId>io.github.jmltoolkit</groupId>
<version>3.25.3-SNAPSHOT</version>
<version>3.25.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
import com.github.javaparser.ast.jml.doc.JmlDocType;
import com.github.javaparser.ast.visitor.VoidVisitorAdapter;
import com.github.javaparser.jml.JmlDocSanitizer;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.TestFactory;
import org.junit.jupiter.api.*;

import java.io.File;
import java.io.FileWriter;
Expand All @@ -35,8 +32,11 @@
* @author Alexander Weigl
* @version 1 (7/2/21)
*/
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class FullExamplesTest {
private final JavaParser jpb;
private long lines;
private long time;

{
//private final StoreJMLComments storeProcessor = new StoreJMLComments()
Expand Down Expand Up @@ -155,7 +155,14 @@ Stream<DynamicTest> createTests(Predicate<Path> pred) throws IOException {
private void testParse(Path p) throws IOException {
Assumptions.assumeFalse(isBlocked(p));
System.out.println(p);
ParseResult<CompilationUnit> result = jpb.parse(p);
var content = Files.readString(p);
long start = System.nanoTime();
ParseResult<CompilationUnit> result = jpb.parse(content);
long stop = System.nanoTime();

time += (stop - start);
lines += content.chars().filter(it -> it == '\n').count();

result.getProblems().forEach(it -> {
int line = it.getLocation().map(l -> l.getBegin().getRange().map(r -> r.begin.line).orElse(-1)).orElse(-1);
System.out.format("%s\n\t%s:%d\n\n", it.getMessage(), p.toUri(), line);
Expand All @@ -169,6 +176,11 @@ private boolean isBlocked(Path it) {
return blockedPaths.contains(it);
}

@AfterAll
public void stat() {
System.out.format("Performance: %d LoCs in %d ns%n", lines, time);
System.out.format("Performance: %.0f LoCs/ms", lines * 1000000.0 / time);
}

}

Expand Down
2 changes: 1 addition & 1 deletion jmlparser-jml-tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>jmlparser-parent</artifactId>
<groupId>io.github.jmltoolkit</groupId>
<version>3.25.3-SNAPSHOT</version>
<version>3.25.3</version>
</parent>

<artifactId>jmlparser-jml-tools</artifactId>
Expand Down
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<module>javaparser-symbol-solver-testing</module>
<module>jmlparser-jml-tests</module>
<module>jmlparser-jml-tools</module>
<!--<module>jmlparser-web</module>-->
</modules>

<groupId>io.github.jmltoolkit</groupId>
Expand Down

0 comments on commit 7ca59d5

Please sign in to comment.