Skip to content

Commit

Permalink
merge aftermath, regeneration of models
Browse files Browse the repository at this point in the history
  • Loading branch information
wadoon committed Jan 27, 2024
1 parent 4944354 commit 616199d
Show file tree
Hide file tree
Showing 69 changed files with 2,931 additions and 3,050 deletions.
2 changes: 1 addition & 1 deletion javaparser-core-generators/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>jmlparser-parent</artifactId>
<groupId>io.github.jmltoolkit</groupId>
<version>3.25.8</version>
<version>3.25.8-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion javaparser-core-metamodel-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>jmlparser-parent</artifactId>
<groupId>io.github.jmltoolkit</groupId>
<version>3.25.8</version>
<version>3.25.8-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion javaparser-core-serialization/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>jmlparser-parent</artifactId>
<groupId>io.github.jmltoolkit</groupId>
<version>3.25.8</version>
<version>3.25.8-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@

import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.Node;
import com.google.common.truth.Truth;
import jakarta.json.Json;
import jakarta.json.stream.JsonGenerator;
import jakarta.json.stream.JsonGeneratorFactory;
import org.junit.Assume;
import org.junit.jupiter.api.Test;

import javax.json.Json;
import javax.json.stream.JsonGenerator;
import javax.json.stream.JsonGeneratorFactory;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
Expand Down
2 changes: 1 addition & 1 deletion javaparser-core-testing-bdd/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>jmlparser-parent</artifactId>
<groupId>io.github.jmltoolkit</groupId>
<version>3.25.8</version>
<version>3.25.8-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion javaparser-core-testing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>jmlparser-parent</artifactId>
<groupId>io.github.jmltoolkit</groupId>
<version>3.25.8</version>
<version>3.25.8-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
1 change: 1 addition & 0 deletions javaparser-core/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Bundle-SymbolicName: com.github.javaparser.javaparser-core
com.github.javaparser.printer.lexicalpreservation.changes, \
com.github.javaparser.quality, \
com.github.javaparser.resolution, \
com.github.javaparser.resolution.cache, \
com.github.javaparser.resolution.declarations, \
com.github.javaparser.resolution.logic, \
com.github.javaparser.resolution.model, \
Expand Down
2 changes: 1 addition & 1 deletion javaparser-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>jmlparser-parent</artifactId>
<groupId>io.github.jmltoolkit</groupId>
<version>3.25.8</version>
<version>3.25.8-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/

package com.github.javaparser;

import com.github.javaparser.ast.CompilationUnit;
Expand All @@ -38,7 +37,6 @@
import com.github.javaparser.ast.type.Type;
import com.github.javaparser.ast.type.TypeParameter;
import com.github.javaparser.javadoc.Javadoc;

import java.io.*;
import java.nio.file.Path;
import java.util.Objects;
Expand Down Expand Up @@ -79,102 +77,101 @@ private <T extends Node> T handleResult(ParseResult<T> result) {
if (result.isSuccessful()) {
return result.getResult().orElse(null);
}

throw new ParseProblemException(result.getProblems());
}

public ParserConfiguration getParserConfiguration() {
return parser.getParserConfiguration();
}

public CompilationUnit parse(InputStream in) {
return handleResult(getParser().parse(in));
}

public CompilationUnit parse(File file) throws FileNotFoundException {
return handleResult(getParser().parse(file));
}

public CompilationUnit parse(Path path) throws IOException {
return handleResult(getParser().parse(path));
}

public CompilationUnit parse(Reader reader) {
return handleResult(getParser().parse(reader));
}

public CompilationUnit parse(String code) {
return handleResult(getParser().parse(code));
}

public CompilationUnit parseResource(String path) throws IOException {
return handleResult(getParser().parseResource(path));
}

public BlockStmt parseBlock(String blockStatement) {
return handleResult(getParser().parseBlock(blockStatement));
}

public Statement parseStatement(String statement) {
return handleResult(getParser().parseStatement(statement));
}

public ImportDeclaration parseImport(String importDeclaration) {
return handleResult(getParser().parseImport(importDeclaration));
}

public <T extends Expression> T parseExpression(String expression) {
return handleResult(getParser().parseExpression(expression));
}

public AnnotationExpr parseAnnotation(String annotation) {
return handleResult(getParser().parseAnnotation(annotation));
}

public BodyDeclaration<?> parseAnnotationBodyDeclaration(String body) {
return handleResult(getParser().parseAnnotationBodyDeclaration(body));
}

public BodyDeclaration<?> parseBodyDeclaration(String body) {
return handleResult(getParser().parseBodyDeclaration(body));
}

public ClassOrInterfaceType parseClassOrInterfaceType(String type) {
return handleResult(getParser().parseClassOrInterfaceType(type));
}

public Type parseType(String type) {
return handleResult(getParser().parseType(type));
}

public VariableDeclarationExpr parseVariableDeclarationExpr(String declaration) {
return handleResult(getParser().parseVariableDeclarationExpr(declaration));
}

public Javadoc parseJavadoc(String content) {
return JavadocParser.parse(content);
}

public ExplicitConstructorInvocationStmt parseExplicitConstructorInvocationStmt(String statement) {
return handleResult(getParser().parseExplicitConstructorInvocationStmt(statement));
}

public Name parseName(String qualifiedName) {
return handleResult(getParser().parseName(qualifiedName));
}

public SimpleName parseSimpleName(String name) {
return handleResult(getParser().parseSimpleName(name));
}

public Parameter parseParameter(String parameter) {
return handleResult(getParser().parseParameter(parameter));
}

public PackageDeclaration parsePackageDeclaration(String packageDeclaration) {
return handleResult(getParser().parsePackageDeclaration(packageDeclaration));
}

public TypeDeclaration<?> parseTypeDeclaration(String typeDeclaration) {
return handleResult(getParser().parseTypeDeclaration(typeDeclaration));
}
Expand All @@ -190,7 +187,7 @@ public ModuleDirective parseModuleDirective(String moduleDirective) {
public TypeParameter parseTypeParameter(String typeParameter) {
return handleResult(getParser().parseTypeParameter(typeParameter));
}

public MethodDeclaration parseMethodDeclaration(String methodDeclaration) {
return handleResult(getParser().parseMethodDeclaration(methodDeclaration));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,9 @@ public PositionUpdate lookup(Position position) {
}
int insertIndex = -result - 1;
if (insertIndex == 0) {
// Before the first delta info, identity mapping.
return PositionUpdate.NONE;
}
// Before the first delta info, identity mapping.
return PositionUpdate.NONE;
}
return _deltas.get(insertIndex - 1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@
import com.github.javaparser.ast.NodeList;
import com.github.javaparser.ast.body.Parameter;
import com.github.javaparser.ast.type.Type;

import java.util.Arrays;
import java.util.Optional;
import java.util.stream.Stream;

import static com.github.javaparser.StaticJavaParser.parseType;
import static java.util.stream.Collectors.toList;

Expand Down Expand Up @@ -162,8 +160,8 @@ default boolean hasParametersOfType(String... paramTypes) {
* @return {@code true} if all parameters match one by one, in the given order.
*/
default boolean hasParametersOfType(Class<?>... paramTypes) {
return getParameters().stream().// if p.getType() is a class or interface type, we want to consider its erasure, i.e., if the parameter
// is "List<String>", we want to consider it as "List", so we need to call getName()
return // if p.getType() is a class or interface type, we want to consider its erasure, i.e., if the parameter
getParameters().stream().// is "List<String>", we want to consider it as "List", so we need to call getName()
map(p -> p.getType().toClassOrInterfaceType().map(NodeWithSimpleName::getNameAsString).orElseGet(() -> p.getType().asString())).collect(toList()).equals(Stream.of(paramTypes).map(Class::getSimpleName).collect(toList()));
}
}
Loading

0 comments on commit 616199d

Please sign in to comment.