Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.NodeList;
import com.github.javaparser.ast.comments.Comment;
import com.github.javaparser.ast.jml.doc.JmlDoc;
import com.github.javaparser.ast.jml.doc.JmlDocModifier;
import com.github.javaparser.metamodel.BaseNodeMetaModel;
import com.github.javaparser.metamodel.PropertyMetaModel;
import com.github.javaparser.utils.Log;
Expand Down Expand Up @@ -107,9 +109,15 @@ private Node deserializeObject(JsonObject nodeJson) {
parameters.put(name, Boolean.parseBoolean(nodeJson.getString(name)));
} else if (Enum.class.isAssignableFrom(type)) {
parameters.put(name, Enum.valueOf((Class<? extends Enum>) type, nodeJson.getString(name)));
} else if (type == Modifier.DefaultKeyword.class) {
// TODO weigl handle JmlDocModifier?
parameters.put(name, Enum.valueOf(Modifier.DefaultKeyword.class, nodeJson.getString(name)));
} else if (type == Modifier.Keyword.class) {
Modifier.Keyword value;
final var string = nodeJson.getString(name);
try {
value = Enum.valueOf(Modifier.DefaultKeyword.class, string);
} catch (IllegalArgumentException e) {
value = new JmlDocModifier(new NodeList<>(new JmlDoc(string)));
}
parameters.put(name, value);
} else {
throw new IllegalStateException("Don't know how to convert: " + type);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void testSourcePositionsWithBrokenUnicodeEscapes() {
ParseResult<CompilationUnit> cu = parseWithUnicodeEscapes(code);
assertFalse(cu.getResult().isPresent());
assertEquals(
"Lexical error at line 1, column 34. Encountered: \"\\\"\" (34), after : \"\\\"\\\\uABC\"",
"Lexical error at line 1, column 34. Encountered: '\\\"' (34), after prefix \"\\\"\\\\uABC\"",
cu.getProblem(0).getMessage());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void testKindEnum() {

@Test
void testKindEnum2() {
final int tokenCount = GeneratedJavaParserConstants.tokenImage.length;
final int tokenCount = GeneratedJavaParserConstants.tokenImage.length - 1;
for (int i = 0; i < tokenCount; i++) {
System.out.println(i);
JavaToken.Kind kind = JavaToken.Kind.valueOf(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ void visit_GivenConstructorDeclaration() {

// Verify
InOrder order = Mockito.inOrder(node);
order.verify(node).getBody();
order.verify(node, times(2)).getBody();
order.verify(node).getModifiers();
order.verify(node).getName();
order.verify(node).getParameters();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ void visit_GivenConstructorDeclaration() {

// Verify
InOrder order = Mockito.inOrder(node);
order.verify(node).getBody();
order.verify(node, times(2)).getBody();
order.verify(node).getModifiers();
order.verify(node).getName();
order.verify(node).getParameters();
Expand Down Expand Up @@ -1832,7 +1832,6 @@ void visit_GivenThisExpr() {
Mockito.when(node.getTypeName()).thenReturn(Optional.of(mock(Name.class)));
Mockito.when(node.getComment()).thenReturn(Optional.of(mock(Comment.class)));


// Then
Object result = visitor.visit(node, argument);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ void testVisitConditionalExpr() {
void testVisitConstructorDeclaration() {
ConstructorDeclaration node = spy(new ConstructorDeclaration());
HashCodeVisitor.hashCode(node);
verify(node, times(1)).getBody();
verify(node, times(2)).getBody();
verify(node, times(1)).getModifiers();
verify(node, times(1)).getName();
verify(node, times(1)).getParameters();
Expand All @@ -281,7 +281,8 @@ void testVisitConstructorDeclaration() {
verify(node, times(1)).getTypeParameters();
verify(node, times(1)).getAnnotations();
verify(node, times(1)).getComment();
//JML

// JML
verify(node, times(1)).getContracts();
}

Expand All @@ -300,7 +301,7 @@ void testVisitDoStmt() {
verify(node, times(1)).getBody();
verify(node, times(1)).getCondition();
verify(node, times(1)).getComment();
//JML
// JML
verify(node, times(1)).getContracts();
}

Expand Down Expand Up @@ -398,7 +399,7 @@ void testVisitForEachStmt() {
verify(node, times(1)).getIterable();
verify(node, times(1)).getVariable();
verify(node, times(1)).getComment();
//JML
// JML
verify(node, times(1)).getContracts();
}

Expand Down Expand Up @@ -497,7 +498,7 @@ void testVisitLambdaExpr() {
verify(node, times(1)).isEnclosingParameters();
verify(node, times(1)).getParameters();
verify(node, times(1)).getComment();
//JML
// JML
verify(node, times(1)).getContracts();
}

Expand Down Expand Up @@ -575,7 +576,7 @@ void testVisitMethodDeclaration() {
verify(node, times(1)).getTypeParameters();
verify(node, times(1)).getAnnotations();
verify(node, times(1)).getComment();
//JML
// JML
verify(node, times(1)).getContracts();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ void testVisitConstructorDeclaration() {
ConstructorDeclaration node = spy(new ConstructorDeclaration());
NoCommentHashCodeVisitor.hashCode(node);

verify(node, times(1)).getBody();
verify(node, times(2)).getBody();
verify(node, times(1)).getModifiers();
verify(node, times(1)).getName();
verify(node, times(1)).getParameters();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,97 +1 @@
com/github/javaparser/generator/CompilationUnitGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/node/AcceptGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/node/CloneGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/node/GetMetaModelGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/node/MainConstructorGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/node/NodeModifierGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/node/PropertyGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/node/RemoveMethodGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/node/ReplaceMethodGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/node/TypeCastingGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/other/BndGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/other/TokenKindGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/quality/NotNullGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/utils/CodeUtils.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/visitor/CloneVisitorGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/visitor/EqualsVisitorGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/visitor/GenericListVisitorAdapterGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/visitor/GenericVisitorAdapterGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/visitor/GenericVisitorGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/visitor/GenericVisitorWithDefaultsGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/visitor/HashCodeVisitorGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/visitor/ModifierVisitorGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/visitor/NoCommentEqualsVisitorGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/visitor/NoCommentHashCodeVisitorGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/visitor/ObjectIdentityEqualsVisitorGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/visitor/ObjectIdentityHashCodeVisitorGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/visitor/VoidVisitorAdapterGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/visitor/VoidVisitorGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/core/visitor/VoidVisitorWithDefaultsGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/Generator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/NodeGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/VisitorGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

32 problems in 32 files
0 problems in 0 files
Original file line number Diff line number Diff line change
@@ -1,13 +1 @@
com/github/javaparser/generator/AbstractGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/metamodel/AstTypeAnalysis.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/metamodel/MetaModelGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

com/github/javaparser/generator/metamodel/NodeMetaModelGenerator.java
Cannot invoke "com.github.javaparser.ast.NodeList.forEach(java.util.function.Consumer)" because the return value of "com.github.javaparser.ast.body.ConstructorDeclaration.getContracts()" is null

4 problems in 4 files
0 problems in 0 files
Loading
Loading