Skip to content

Commit 281b53f

Browse files
committed
Format code.
1 parent 8164ac8 commit 281b53f

File tree

7 files changed

+332
-123
lines changed

7 files changed

+332
-123
lines changed

javaparser-core/src/main/java/com/github/javaparser/JavaParser.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@
2222

2323
import static com.github.javaparser.ParseStart.*;
2424
import static com.github.javaparser.Problem.PROBLEM_BY_BEGIN_POSITION;
25+
import static com.github.javaparser.Providers.UTF8;
2526
import static com.github.javaparser.Providers.provider;
2627
import static com.github.javaparser.Providers.resourceProvider;
27-
import static com.github.javaparser.Providers.UTF8;
2828
import static com.github.javaparser.utils.Utils.assertNotNull;
2929
import static java.util.stream.Collectors.toList;
3030

3131
import com.github.javaparser.ast.CompilationUnit;
3232
import com.github.javaparser.ast.ImportDeclaration;
33-
import com.github.javaparser.ast.StubUnit;
3433
import com.github.javaparser.ast.Node;
3534
import com.github.javaparser.ast.PackageDeclaration;
35+
import com.github.javaparser.ast.StubUnit;
3636
import com.github.javaparser.ast.body.BodyDeclaration;
3737
import com.github.javaparser.ast.body.MethodDeclaration;
3838
import com.github.javaparser.ast.body.Parameter;
@@ -224,7 +224,7 @@ public ParseResult<CompilationUnit> parse(final File file, final Charset encodin
224224
* @throws FileNotFoundException the file was not found.
225225
*/
226226
public ParseResult<StubUnit> parseStubUnit(final File file, final Charset encoding) throws FileNotFoundException {
227-
ParseResult<StubUnit> result = parse(STUB_UNIT, provider(file, encoding));
227+
ParseResult<StubUnit> result = parse(STUB_UNIT, provider(file, encoding));
228228
result.getResult().ifPresent(cu -> cu.setStorage(file.toPath()));
229229
return result;
230230
}
@@ -256,7 +256,7 @@ public ParseResult<CompilationUnit> parse(final File file) throws FileNotFoundEx
256256
* @throws FileNotFoundException the file was not found.
257257
*/
258258
public ParseResult<StubUnit> parseStubUnit(final File file) throws FileNotFoundException {
259-
ParseResult<StubUnit> result = parse(STUB_UNIT, provider(file));
259+
ParseResult<StubUnit> result = parse(STUB_UNIT, provider(file));
260260
result.getResult().ifPresent(cu -> cu.setStorage(file.toPath()));
261261
return result;
262262
}
@@ -417,7 +417,8 @@ public ParseResult<CompilationUnit> parseResource(
417417
* @throws ParseProblemException if the source code has parser errors.
418418
* @throws IOException the path could not be accessed.
419419
*/
420-
public ParseResult<StubUnit> parseResourceStubUnit(final ClassLoader classLoader, final String path, Charset encoding) throws IOException {
420+
public ParseResult<StubUnit> parseResourceStubUnit(
421+
final ClassLoader classLoader, final String path, Charset encoding) throws IOException {
421422
return parse(STUB_UNIT, resourceProvider(classLoader, path, encoding));
422423
}
423424

javaparser-core/src/main/java/com/github/javaparser/ParseStart.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
import com.github.javaparser.ast.CompilationUnit;
2424
import com.github.javaparser.ast.ImportDeclaration;
25-
import com.github.javaparser.ast.StubUnit;
2625
import com.github.javaparser.ast.PackageDeclaration;
26+
import com.github.javaparser.ast.StubUnit;
2727
import com.github.javaparser.ast.body.BodyDeclaration;
2828
import com.github.javaparser.ast.body.MethodDeclaration;
2929
import com.github.javaparser.ast.body.Parameter;

javaparser-core/src/main/java/com/github/javaparser/StaticJavaParser.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,8 @@ public static CompilationUnit parseResource(
355355
* @throws ParseProblemException if the source code has parser errors
356356
* @throws IOException the path could not be accessed
357357
*/
358-
public static StubUnit parseResourceStubUnit(final ClassLoader classLoader, final String path, Charset encoding) throws IOException {
358+
public static StubUnit parseResourceStubUnit(final ClassLoader classLoader, final String path, Charset encoding)
359+
throws IOException {
359360
return handleResult(newParser().parseResourceStubUnit(classLoader, path, encoding));
360361
}
361362

javaparser-core/src/main/java/com/github/javaparser/ast/StubUnit.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package com.github.javaparser.ast;
22

3+
import static com.github.javaparser.Providers.UTF8;
4+
import static com.github.javaparser.Providers.provider;
5+
36
import com.github.javaparser.JavaParser;
47
import com.github.javaparser.ParseResult;
58
import com.github.javaparser.ParseStart;
@@ -8,17 +11,13 @@
811
import com.github.javaparser.ast.visitor.VoidVisitor;
912
import com.github.javaparser.metamodel.InternalProperty;
1013
import com.github.javaparser.printer.PrettyPrinter;
11-
1214
import java.io.IOException;
1315
import java.nio.file.Files;
1416
import java.nio.file.Path;
1517
import java.util.List;
1618
import java.util.Optional;
1719
import java.util.function.Function;
1820

19-
import static com.github.javaparser.Providers.UTF8;
20-
import static com.github.javaparser.Providers.provider;
21-
2221
/**
2322
* <p>
2423
* This class represents a stub file. The stub file is concentration of multiple Java files (1+),

javaparser-core/src/main/java/com/github/javaparser/ast/visitor/HashCodeVisitor.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,10 @@ public Integer visit(final CompilationUnit n, final Void arg) {
190190

191191
// TODO Implement HashCodeVisitor # visit on StubUnit
192192
public Integer visit(StubUnit n, Void arg) {
193-
//return (n.getImports().accept(this, arg)) * 31 + (n.getModule().isPresent() ? n.getModule().get().accept(this, arg) : 0) * 31 + (n.getPackageDeclaration().isPresent() ? n.getPackageDeclaration().get().accept(this, arg) : 0) * 31 + (n.getTypes().accept(this, arg)) * 31 + (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
193+
// return (n.getImports().accept(this, arg)) * 31 + (n.getModule().isPresent() ?
194+
// n.getModule().get().accept(this, arg) : 0) * 31 + (n.getPackageDeclaration().isPresent() ?
195+
// n.getPackageDeclaration().get().accept(this, arg) : 0) * 31 + (n.getTypes().accept(this, arg)) * 31 +
196+
// (n.getComment().isPresent() ? n.getComment().get().accept(this, arg) : 0);
194197
throw new RuntimeException("The method is not implemented!");
195198
}
196199

0 commit comments

Comments
 (0)