aboutsummaryrefslogtreecommitdiff
path: root/test/core/src/lombok
diff options
context:
space:
mode:
authorReinier Zwitserloot <r.zwitserloot@projectlombok.org>2020-09-18 02:27:35 +0200
committerReinier Zwitserloot <r.zwitserloot@projectlombok.org>2020-09-18 02:27:35 +0200
commit730670f1f4f41f41f23da6df59c06c40f717139a (patch)
tree392aeac4ec636bbceda0e8c9647d0c05e6c4014a /test/core/src/lombok
parentea1578a0a9826473e004901f8e2a88ba4e65ea4c (diff)
parent23b80658bcf3ca0007a86d04ce6cc5f6c8db5ad4 (diff)
downloadlombok-730670f1f4f41f41f23da6df59c06c40f717139a.tar.gz
lombok-730670f1f4f41f41f23da6df59c06c40f717139a.tar.bz2
lombok-730670f1f4f41f41f23da6df59c06c40f717139a.zip
Merge branch 'eclipse-javadoc' of git://github.com/Rawi01/lombok into Rawi01-eclipse-javadoc
# Conflicts: # src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
Diffstat (limited to 'test/core/src/lombok')
-rw-r--r--test/core/src/lombok/RunTestsViaEcj.java41
1 files changed, 40 insertions, 1 deletions
diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java
index dedafc0d..b98c19b7 100644
--- a/test/core/src/lombok/RunTestsViaEcj.java
+++ b/test/core/src/lombok/RunTestsViaEcj.java
@@ -37,6 +37,7 @@ import lombok.javac.CapturingDiagnosticListener.CompilerMessage;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.compiler.CategorizedProblem;
+import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.internal.compiler.CompilationResult;
@@ -106,7 +107,7 @@ public class RunTestsViaEcj extends AbstractRunTests {
String source = readFile(file);
char[] sourceArray = source.toCharArray();
- final org.eclipse.jdt.internal.compiler.batch.CompilationUnit sourceUnit = new org.eclipse.jdt.internal.compiler.batch.CompilationUnit(sourceArray, file.getName(), encoding == null ? "UTF-8" : encoding);
+ final ICompilationUnit sourceUnit = new TestCompilationUnit(file.getName(), source);
Compiler ecjCompiler = new Compiler(createFileSystem(file, minVersion), ecjErrorHandlingPolicy(), ecjCompilerOptions(), bitbucketRequestor, new DefaultProblemFactory(Locale.ENGLISH)) {
@Override protected synchronized void addCompilationUnit(ICompilationUnit inUnit, CompilationUnitDeclaration parsedUnit) {
@@ -182,4 +183,42 @@ public class RunTestsViaEcj extends AbstractRunTests {
}
return new FileSystem(classpath.toArray(new String[0]), new String[] {file.getAbsolutePath()}, "UTF-8");
}
+
+ private static final class TestCompilationUnit extends org.eclipse.jdt.internal.core.CompilationUnit {
+ private final char[] source;
+ private final char[] mainTypeName;
+
+ private TestCompilationUnit(String name, String source) {
+ super(null, name, null);
+ this.source = source.toCharArray();
+
+ char[] fileNameCharArray = getFileName();
+ int start = CharOperation.lastIndexOf(File.separatorChar, fileNameCharArray) + 1;
+ int end = CharOperation.lastIndexOf('.', fileNameCharArray);
+ if (end == -1) {
+ end = fileNameCharArray.length;
+ }
+ mainTypeName = CharOperation.subarray(fileNameCharArray, start, end);
+ }
+
+ @Override public char[] getContents() {
+ return source;
+ }
+
+ @Override public char[] getMainTypeName() {
+ return mainTypeName;
+ }
+
+ @Override public boolean ignoreOptionalProblems() {
+ return false;
+ }
+
+ @Override public char[][] getPackageName() {
+ return null;
+ }
+
+ @Override public char[] getModuleName() {
+ return null;
+ }
+ }
}