-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3522 from jlerbsc/issue1743
Improve Conditional Operator resolution [JLS 15.25]
- Loading branch information
Showing
15 changed files
with
417 additions
and
355 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
javaparser-core-testing/src/test/resources/com/github/javaparser/utils/Bla.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
class X { | ||
} | ||
class X { | ||
} |
4 changes: 2 additions & 2 deletions
4
javaparser-core-testing/src/test/resources/com/github/javaparser/utils/module-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
module M.N { | ||
} | ||
module M.N { | ||
} |
92 changes: 46 additions & 46 deletions
92
...sources/com/github/javaparser/utils/projectroot/issue2615/with_module_info/demo/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,46 @@ | ||
package demo; | ||
|
||
import com.github.javaparser.ParseResult; | ||
import com.github.javaparser.ast.CompilationUnit; | ||
import com.github.javaparser.utils.ParserCollectionStrategy; | ||
import com.github.javaparser.utils.ProjectRoot; | ||
import com.github.javaparser.utils.SourceRoot; | ||
import java.io.IOException; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
/* If there is a module declaration in the root directory, JavaParser doesn't find any .java files. */ | ||
public class Main { | ||
|
||
public static void main(String[] args) { | ||
if (args.length < 1) { | ||
System.err.println("Usage: provide one or more directory names to process"); | ||
System.exit(1); | ||
} | ||
for (String dir : args) { | ||
process(dir); | ||
} | ||
} | ||
|
||
private static void process(String dir) { | ||
Path root = Paths.get(dir); | ||
Callback cb = new Callback(); | ||
ProjectRoot projectRoot = new ParserCollectionStrategy().collect(root); | ||
projectRoot.getSourceRoots().forEach(sourceRoot -> { | ||
try { | ||
sourceRoot.parse("", cb); | ||
} catch (IOException e) { | ||
System.err.println("IOException: " + e); | ||
} | ||
}); | ||
} | ||
|
||
private static class Callback implements SourceRoot.Callback { | ||
|
||
@Override | ||
public Result process(Path localPath, Path absolutePath, ParseResult<CompilationUnit> result) { | ||
System.out.printf("Found %s%n", absolutePath); | ||
return Result.SAVE; | ||
} | ||
} | ||
} | ||
package demo; | ||
|
||
import com.github.javaparser.ParseResult; | ||
import com.github.javaparser.ast.CompilationUnit; | ||
import com.github.javaparser.utils.ParserCollectionStrategy; | ||
import com.github.javaparser.utils.ProjectRoot; | ||
import com.github.javaparser.utils.SourceRoot; | ||
import java.io.IOException; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
/* If there is a module declaration in the root directory, JavaParser doesn't find any .java files. */ | ||
public class Main { | ||
|
||
public static void main(String[] args) { | ||
if (args.length < 1) { | ||
System.err.println("Usage: provide one or more directory names to process"); | ||
System.exit(1); | ||
} | ||
for (String dir : args) { | ||
process(dir); | ||
} | ||
} | ||
|
||
private static void process(String dir) { | ||
Path root = Paths.get(dir); | ||
Callback cb = new Callback(); | ||
ProjectRoot projectRoot = new ParserCollectionStrategy().collect(root); | ||
projectRoot.getSourceRoots().forEach(sourceRoot -> { | ||
try { | ||
sourceRoot.parse("", cb); | ||
} catch (IOException e) { | ||
System.err.println("IOException: " + e); | ||
} | ||
}); | ||
} | ||
|
||
private static class Callback implements SourceRoot.Callback { | ||
|
||
@Override | ||
public Result process(Path localPath, Path absolutePath, ParseResult<CompilationUnit> result) { | ||
System.out.printf("Found %s%n", absolutePath); | ||
return Result.SAVE; | ||
} | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
.../com/github/javaparser/utils/projectroot/issue2615/with_module_info/demo/module-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
module demo { | ||
} | ||
module demo { | ||
} |
92 changes: 46 additions & 46 deletions
92
...com/github/javaparser/utils/projectroot/issue2615/with_module_info_in_root/demo/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,46 @@ | ||
package demo; | ||
|
||
import com.github.javaparser.ParseResult; | ||
import com.github.javaparser.ast.CompilationUnit; | ||
import com.github.javaparser.utils.ParserCollectionStrategy; | ||
import com.github.javaparser.utils.ProjectRoot; | ||
import com.github.javaparser.utils.SourceRoot; | ||
import java.io.IOException; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
/* If there is a module declaration in the root directory, JavaParser doesn't find any .java files. */ | ||
public class Main { | ||
|
||
public static void main(String[] args) { | ||
if (args.length < 1) { | ||
System.err.println("Usage: provide one or more directory names to process"); | ||
System.exit(1); | ||
} | ||
for (String dir : args) { | ||
process(dir); | ||
} | ||
} | ||
|
||
private static void process(String dir) { | ||
Path root = Paths.get(dir); | ||
Callback cb = new Callback(); | ||
ProjectRoot projectRoot = new ParserCollectionStrategy().collect(root); | ||
projectRoot.getSourceRoots().forEach(sourceRoot -> { | ||
try { | ||
sourceRoot.parse("", cb); | ||
} catch (IOException e) { | ||
System.err.println("IOException: " + e); | ||
} | ||
}); | ||
} | ||
|
||
private static class Callback implements SourceRoot.Callback { | ||
|
||
@Override | ||
public Result process(Path localPath, Path absolutePath, ParseResult<CompilationUnit> result) { | ||
System.out.printf("Found %s%n", absolutePath); | ||
return Result.SAVE; | ||
} | ||
} | ||
} | ||
package demo; | ||
|
||
import com.github.javaparser.ParseResult; | ||
import com.github.javaparser.ast.CompilationUnit; | ||
import com.github.javaparser.utils.ParserCollectionStrategy; | ||
import com.github.javaparser.utils.ProjectRoot; | ||
import com.github.javaparser.utils.SourceRoot; | ||
import java.io.IOException; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
/* If there is a module declaration in the root directory, JavaParser doesn't find any .java files. */ | ||
public class Main { | ||
|
||
public static void main(String[] args) { | ||
if (args.length < 1) { | ||
System.err.println("Usage: provide one or more directory names to process"); | ||
System.exit(1); | ||
} | ||
for (String dir : args) { | ||
process(dir); | ||
} | ||
} | ||
|
||
private static void process(String dir) { | ||
Path root = Paths.get(dir); | ||
Callback cb = new Callback(); | ||
ProjectRoot projectRoot = new ParserCollectionStrategy().collect(root); | ||
projectRoot.getSourceRoots().forEach(sourceRoot -> { | ||
try { | ||
sourceRoot.parse("", cb); | ||
} catch (IOException e) { | ||
System.err.println("IOException: " + e); | ||
} | ||
}); | ||
} | ||
|
||
private static class Callback implements SourceRoot.Callback { | ||
|
||
@Override | ||
public Result process(Path localPath, Path absolutePath, ParseResult<CompilationUnit> result) { | ||
System.out.printf("Found %s%n", absolutePath); | ||
return Result.SAVE; | ||
} | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...m/github/javaparser/utils/projectroot/issue2615/with_module_info_in_root/module-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
module demo { | ||
} | ||
module demo { | ||
} |
92 changes: 46 additions & 46 deletions
92
...rces/com/github/javaparser/utils/projectroot/issue2615/without_module_info/demo/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,46 @@ | ||
package demo; | ||
|
||
import com.github.javaparser.ParseResult; | ||
import com.github.javaparser.ast.CompilationUnit; | ||
import com.github.javaparser.utils.ParserCollectionStrategy; | ||
import com.github.javaparser.utils.ProjectRoot; | ||
import com.github.javaparser.utils.SourceRoot; | ||
import java.io.IOException; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
/* If there is a module declaration in the root directory, JavaParser doesn't find any .java files. */ | ||
public class Main { | ||
|
||
public static void main(String[] args) { | ||
if (args.length < 1) { | ||
System.err.println("Usage: provide one or more directory names to process"); | ||
System.exit(1); | ||
} | ||
for (String dir : args) { | ||
process(dir); | ||
} | ||
} | ||
|
||
private static void process(String dir) { | ||
Path root = Paths.get(dir); | ||
Callback cb = new Callback(); | ||
ProjectRoot projectRoot = new ParserCollectionStrategy().collect(root); | ||
projectRoot.getSourceRoots().forEach(sourceRoot -> { | ||
try { | ||
sourceRoot.parse("", cb); | ||
} catch (IOException e) { | ||
System.err.println("IOException: " + e); | ||
} | ||
}); | ||
} | ||
|
||
private static class Callback implements SourceRoot.Callback { | ||
|
||
@Override | ||
public Result process(Path localPath, Path absolutePath, ParseResult<CompilationUnit> result) { | ||
System.out.printf("Found %s%n", absolutePath); | ||
return Result.SAVE; | ||
} | ||
} | ||
} | ||
package demo; | ||
|
||
import com.github.javaparser.ParseResult; | ||
import com.github.javaparser.ast.CompilationUnit; | ||
import com.github.javaparser.utils.ParserCollectionStrategy; | ||
import com.github.javaparser.utils.ProjectRoot; | ||
import com.github.javaparser.utils.SourceRoot; | ||
import java.io.IOException; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
/* If there is a module declaration in the root directory, JavaParser doesn't find any .java files. */ | ||
public class Main { | ||
|
||
public static void main(String[] args) { | ||
if (args.length < 1) { | ||
System.err.println("Usage: provide one or more directory names to process"); | ||
System.exit(1); | ||
} | ||
for (String dir : args) { | ||
process(dir); | ||
} | ||
} | ||
|
||
private static void process(String dir) { | ||
Path root = Paths.get(dir); | ||
Callback cb = new Callback(); | ||
ProjectRoot projectRoot = new ParserCollectionStrategy().collect(root); | ||
projectRoot.getSourceRoots().forEach(sourceRoot -> { | ||
try { | ||
sourceRoot.parse("", cb); | ||
} catch (IOException e) { | ||
System.err.println("IOException: " + e); | ||
} | ||
}); | ||
} | ||
|
||
private static class Callback implements SourceRoot.Callback { | ||
|
||
@Override | ||
public Result process(Path localPath, Path absolutePath, ParseResult<CompilationUnit> result) { | ||
System.out.printf("Found %s%n", absolutePath); | ||
return Result.SAVE; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.