From 1a4090914e1d808fa01f0ee1fb644ae18b4c2b05 Mon Sep 17 00:00:00 2001 From: Federico Tomassetti Date: Wed, 10 Jan 2018 17:07:46 +0100 Subject: [PATCH] handling remaining JDK9 differences for JSS tests --- .../resolution/AnalyseNewJavaParserTest.java | 12 ++++++- .../com_github_javaparser_ast_Modifier_J9.txt | 4 +++ ...olver_javaparsermodel_TypeExtractor_J9.txt | 2 +- ...lver_model_typesystem_PrimitiveType_J9.txt | 33 +++++++++++++++++++ 4 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 javaparser-symbol-solver-testing/src/test/resources/javaparser_methodcalls_expected_output/com_github_javaparser_ast_Modifier_J9.txt create mode 100644 javaparser-symbol-solver-testing/src/test/resources/javasymbolsolver_0_6_0/expected_output/java-symbol-solver-model/com_github_javaparser_symbolsolver_model_typesystem_PrimitiveType_J9.txt diff --git a/javaparser-symbol-solver-testing/src/test/java/com/github/javaparser/symbolsolver/resolution/AnalyseNewJavaParserTest.java b/javaparser-symbol-solver-testing/src/test/java/com/github/javaparser/symbolsolver/resolution/AnalyseNewJavaParserTest.java index c033a4d2d6..a06dd058da 100644 --- a/javaparser-symbol-solver-testing/src/test/java/com/github/javaparser/symbolsolver/resolution/AnalyseNewJavaParserTest.java +++ b/javaparser-symbol-solver-testing/src/test/java/com/github/javaparser/symbolsolver/resolution/AnalyseNewJavaParserTest.java @@ -71,9 +71,19 @@ private void parse(String fileName) throws IOException, ParseException { sourceFileInfoExtractor.solveMethodCalls(sourceFile); String output = outErrStream.toString(); - String path = adaptPath(new File("src/test/resources/javaparser_methodcalls_expected_output")).getPath() + "/" + fileName.replaceAll("/", "_") + ".txt"; + File expectedOutput = new File("src/test/resources/javaparser_methodcalls_expected_output"); + String path = adaptPath(expectedOutput).getPath() + "/" + fileName.replaceAll("/", "_") + ".txt"; File dstFile = new File(path); + if (isJava9()) { + String path9 = adaptPath(expectedOutput).getPath() + "/" + fileName.replaceAll("/", "_") + "_J9.txt"; + File dstFile9 = new File(path9); + if (dstFile9.exists()) { + path = path9; + dstFile = dstFile9; + } + } + if (DEBUG && (sourceFileInfoExtractor.getKo() != 0 || sourceFileInfoExtractor.getUnsupported() != 0)) { System.err.println(output); } diff --git a/javaparser-symbol-solver-testing/src/test/resources/javaparser_methodcalls_expected_output/com_github_javaparser_ast_Modifier_J9.txt b/javaparser-symbol-solver-testing/src/test/resources/javaparser_methodcalls_expected_output/com_github_javaparser_ast_Modifier_J9.txt new file mode 100644 index 0000000000..c17b5bfce3 --- /dev/null +++ b/javaparser-symbol-solver-testing/src/test/resources/javaparser_methodcalls_expected_output/com_github_javaparser_ast_Modifier_J9.txt @@ -0,0 +1,4 @@ + Line 32) EnumSet.of(this) ==> java.util.Set.of(E...) + Line 36) modifiers.contains(Modifier.PUBLIC) ==> java.util.AbstractCollection.contains(java.lang.Object) + Line 38) modifiers.contains(Modifier.PROTECTED) ==> java.util.AbstractCollection.contains(java.lang.Object) + Line 40) modifiers.contains(Modifier.PRIVATE) ==> java.util.AbstractCollection.contains(java.lang.Object) diff --git a/javaparser-symbol-solver-testing/src/test/resources/javasymbolsolver_0_6_0/expected_output/java-symbol-solver-core/com_github_javaparser_symbolsolver_javaparsermodel_TypeExtractor_J9.txt b/javaparser-symbol-solver-testing/src/test/resources/javasymbolsolver_0_6_0/expected_output/java-symbol-solver-core/com_github_javaparser_symbolsolver_javaparsermodel_TypeExtractor_J9.txt index 9291a06b53..28c113fd7d 100644 --- a/javaparser-symbol-solver-testing/src/test/resources/javasymbolsolver_0_6_0/expected_output/java-symbol-solver-core/com_github_javaparser_symbolsolver_javaparsermodel_TypeExtractor_J9.txt +++ b/javaparser-symbol-solver-testing/src/test/resources/javasymbolsolver_0_6_0/expected_output/java-symbol-solver-core/com_github_javaparser_symbolsolver_javaparsermodel_TypeExtractor_J9.txt @@ -40,7 +40,7 @@ Line 146) node.getType() ==> com.github.javaparser.ast.expr.ClassExpr.getType() Line 147) facade.convertToUsage(astType, node.getType()) ==> com.github.javaparser.symbolsolver.javaparsermodel.JavaParserFacade.convertToUsage(com.github.javaparser.ast.type.Type, com.github.javaparser.ast.Node) Line 147) node.getType() ==> com.github.javaparser.ast.expr.ClassExpr.getType() - Line 148) ImmutableList.of(jssType) ==> com.google.common.collect.ImmutableList.of(E) + Line 148) ImmutableList.of(jssType) ==> java.util.List.of(E...) Line 153) node.getThenExpr().accept(this, solveLambdas) ==> com.github.javaparser.ast.visitor.Visitable.accept(com.github.javaparser.ast.visitor.GenericVisitor, A) Line 153) node.getThenExpr() ==> com.github.javaparser.ast.expr.ConditionalExpr.getThenExpr() Line 158) node.getInner().accept(this, solveLambdas) ==> com.github.javaparser.ast.visitor.Visitable.accept(com.github.javaparser.ast.visitor.GenericVisitor, A) diff --git a/javaparser-symbol-solver-testing/src/test/resources/javasymbolsolver_0_6_0/expected_output/java-symbol-solver-model/com_github_javaparser_symbolsolver_model_typesystem_PrimitiveType_J9.txt b/javaparser-symbol-solver-testing/src/test/resources/javasymbolsolver_0_6_0/expected_output/java-symbol-solver-model/com_github_javaparser_symbolsolver_model_typesystem_PrimitiveType_J9.txt new file mode 100644 index 0000000000..57a7c2a04f --- /dev/null +++ b/javaparser-symbol-solver-testing/src/test/resources/javasymbolsolver_0_6_0/expected_output/java-symbol-solver-model/com_github_javaparser_symbolsolver_model_typesystem_PrimitiveType_J9.txt @@ -0,0 +1,33 @@ + Line 32) Byte.class.getCanonicalName() ==> java.lang.Class.getCanonicalName() + Line 32) ImmutableList.of() ==> com.google.common.collect.ImmutableList.of() + Line 33) Short.class.getCanonicalName() ==> java.lang.Class.getCanonicalName() + Line 33) ImmutableList.of(BYTE) ==> java.util.List.of(E...) + Line 34) Character.class.getCanonicalName() ==> java.lang.Class.getCanonicalName() + Line 34) ImmutableList.of() ==> com.google.common.collect.ImmutableList.of() + Line 35) Integer.class.getCanonicalName() ==> java.lang.Class.getCanonicalName() + Line 35) ImmutableList.of(BYTE, SHORT, CHAR) ==> java.util.List.of(E...) + Line 36) Long.class.getCanonicalName() ==> java.lang.Class.getCanonicalName() + Line 36) ImmutableList.of(BYTE, SHORT, INT, CHAR) ==> java.util.List.of(E...) + Line 37) Boolean.class.getCanonicalName() ==> java.lang.Class.getCanonicalName() + Line 37) ImmutableList.of() ==> com.google.common.collect.ImmutableList.of() + Line 38) Float.class.getCanonicalName() ==> java.lang.Class.getCanonicalName() + Line 38) ImmutableList.of(LONG, INT, SHORT, BYTE, CHAR) ==> java.util.List.of(E...) + Line 39) Double.class.getCanonicalName() ==> java.lang.Class.getCanonicalName() + Line 39) ImmutableList.of(FLOAT, LONG, INT, SHORT, BYTE, CHAR) ==> java.util.List.of(E...) + Line 40) ImmutableList.of(INT, BOOLEAN, LONG, CHAR, FLOAT, DOUBLE, SHORT, BYTE) ==> java.util.List.of(E...) + Line 57) name.toLowerCase() ==> java.lang.String.toLowerCase() + Line 59) ptu.describe().equals(name) ==> java.lang.String.equals(java.lang.Object) + Line 59) ptu.describe() ==> com.github.javaparser.symbolsolver.model.typesystem.PrimitiveType.describe() + Line 104) other.isPrimitive() ==> com.github.javaparser.symbolsolver.model.typesystem.Type.isPrimitive() + Line 105) promotionTypes.contains(other) ==> java.util.List.contains(java.lang.Object) + Line 106) other.isReferenceType() ==> com.github.javaparser.symbolsolver.model.typesystem.Type.isReferenceType() + Line 107) other.asReferenceType().getQualifiedName().equals(boxTypeQName) ==> java.lang.String.equals(java.lang.Object) + Line 107) other.asReferenceType().getQualifiedName() ==> com.github.javaparser.symbolsolver.model.typesystem.ReferenceType.getQualifiedName() + Line 107) other.asReferenceType() ==> com.github.javaparser.symbolsolver.model.typesystem.Type.asReferenceType() + Line 111) other.asReferenceType().getQualifiedName().equals(promotion.boxTypeQName) ==> java.lang.String.equals(java.lang.Object) + Line 111) other.asReferenceType().getQualifiedName() ==> com.github.javaparser.symbolsolver.model.typesystem.ReferenceType.getQualifiedName() + Line 111) other.asReferenceType() ==> com.github.javaparser.symbolsolver.model.typesystem.Type.asReferenceType() + Line 116) other.isConstraint() ==> com.github.javaparser.symbolsolver.model.typesystem.Type.isConstraint() + Line 117) this.isAssignableBy(other.asConstraintType().getBound()) ==> com.github.javaparser.symbolsolver.model.typesystem.PrimitiveType.isAssignableBy(com.github.javaparser.symbolsolver.model.typesystem.Type) + Line 117) other.asConstraintType().getBound() ==> com.github.javaparser.symbolsolver.model.typesystem.LambdaConstraintType.getBound() + Line 117) other.asConstraintType() ==> com.github.javaparser.symbolsolver.model.typesystem.Type.asConstraintType()