Skip to content

Commit

Permalink
Test adaptation for unsupported Java versions
Browse files Browse the repository at this point in the history
See #2536
  • Loading branch information
iloveeclipse committed Jun 24, 2024
1 parent 64b439d commit 3be7fa1
Show file tree
Hide file tree
Showing 236 changed files with 4,923 additions and 9,964 deletions.
8 changes: 8 additions & 0 deletions JCL/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-22"/>

<classpathentry kind="src" path="converterJclMin22/src"/>

<classpathentry kind="output" path="bin"/>
</classpath>
11 changes: 11 additions & 0 deletions JCL/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>JCL</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
164 changes: 164 additions & 0 deletions JCL/converterJclMin1.8/src/java/lang/StringBuilder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
package java.lang;


public final class StringBuilder {

public StringBuilder() {
}

public StringBuilder(int capacity) {
}

public StringBuilder(String str) {
}

public StringBuilder(CharSequence seq) {
}

public StringBuilder append(Object obj) {
return this;
}

public StringBuilder append(String str) {
return this;
}

public StringBuilder append(StringBuffer sb) {
return this;
}

public StringBuilder append(CharSequence s) {
return this;
}

public StringBuilder append(CharSequence s, int start, int end) {
return this;
}

public StringBuilder append(char[] str) {
return this;
}

public StringBuilder append(char[] str, int offset, int len) {
return this;
}

public StringBuilder append(boolean b) {
return this;
}

public StringBuilder append(char c) {
return this;
}


public StringBuilder append(int i) {
return this;
}


public StringBuilder append(long lng) {
return this;
}


public StringBuilder append(float f) {
return this;
}


public StringBuilder append(double d) {
return this;
}

public StringBuilder appendCodePoint(int codePoint) {
return this;
}

public StringBuilder delete(int start, int end) {
return this;
}

public StringBuilder deleteCharAt(int index) {
return this;
}

public StringBuilder replace(int start, int end, String str) {
return this;
}

public StringBuilder insert(int index, char[] str, int offset, int len) {
return this;
}

public StringBuilder insert(int offset, Object obj) {
return this;
}

public StringBuilder insert(int offset, String str) {
return this;
}

public StringBuilder insert(int offset, char[] str) {
return this;
}

public StringBuilder insert(int dstOffset, CharSequence s) {
return this;
}

public StringBuilder insert(int dstOffset, CharSequence s, int start, int end) {
return this;
}

public StringBuilder insert(int offset, boolean b) {
return this;
}

public StringBuilder insert(int offset, char c) {
return this;
}


public StringBuilder insert(int offset, int i) {
return this;
}

public StringBuilder insert(int offset, long l) {
return this;
}

public StringBuilder insert(int offset, float f) {
return this;
}

public StringBuilder insert(int offset, double d) {
return this;
}

public int indexOf(String str) {
return 0;
}

public int indexOf(String str, int fromIndex) {
return 0;
}

public int lastIndexOf(String str) {
return 0;
}

public int lastIndexOf(String str, int fromIndex) {
return 0;
}

public StringBuilder reverse() {
return this;
}

public String toString() {
return "";
}


}
2 changes: 1 addition & 1 deletion org.eclipse.jdt.apt.pluggable.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Require-Bundle: org.junit,
org.eclipse.jdt.core.tests.builder,
org.eclipse.jdt.core.tests.compiler,
org.eclipse.test.performance,
org.eclipse.jdt.core;bundle-version="3.36.0",
org.eclipse.jdt.core;bundle-version="3.38.0",
org.eclipse.ui.ide,
org.eclipse.jdt.annotation;bundle-version="[1.1.0,2.0.0)";resolution:=optional,
org.eclipse.jdt.annotation;bundle-version="[2.0.0,3.0.0)";resolution:=optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
public class TestBase extends BuilderTests
{

protected static final String JAVA_16_COMPLIANCE = "1.6";
protected static final String JAVA_18_COMPLIANCE = "1.8";
protected static final String JAVA_9_COMPLIANCE = "9";

Expand Down Expand Up @@ -91,7 +90,7 @@ private static void addAnnotationJar(IJavaProject jproj, boolean addToModulePath
*/
protected static IJavaProject createJavaProject(final String projectName) throws Exception
{
IPath projectPath = env.addProject(projectName, JAVA_16_COMPLIANCE);
IPath projectPath = env.addProject(projectName, JAVA_18_COMPLIANCE);
env.addExternalJars(projectPath, Util.getJavaClassLibs());
// remove old package fragment root so that names don't collide
env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.apt.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.apt.tests; singleton:=true
Bundle-Version: 3.6.400.qualifier
Bundle-Version: 3.6.500.qualifier
Bundle-ClassPath: apt.jar,
aptext.jar,
.
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.apt.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<relativePath>../tests-pom/</relativePath>
</parent>
<artifactId>org.eclipse.jdt.apt.tests</artifactId>
<version>3.6.400-SNAPSHOT</version>
<version>3.6.500-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.eclipse.jdt.core.tests.builder.BuilderTests;
import org.eclipse.jdt.core.tests.builder.Problem;
import org.eclipse.jdt.core.tests.util.Util;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;

import com.sun.mirror.apt.AnnotationProcessor;

Expand Down Expand Up @@ -96,7 +97,7 @@ protected IJavaProject getCurrentJavaProject() {
protected IJavaProject createJavaProject(final String projectName )
throws Exception
{
IPath projectPath = env.addProject( projectName, "1.5" );
IPath projectPath = env.addProject( projectName, CompilerOptions.getFirstSupportedJavaVersion() );
env.addExternalJars( projectPath, Util.getJavaClassLibs() );
// remove old package fragment root so that names don't collide
env.removePackageFragmentRoot( projectPath, "" ); //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void test_github844() throws IOException {
null /* standardJavaFileManager */,
Arrays.asList(
"-d", OUTPUT_DIR,
"-source", "1.6",
"-source", "1.8",
"-g", "-preserveAllLocals",
"-cp", OUTPUT_DIR + File.pathSeparator + _extJar.getAbsolutePath() ,
"-s", OUTPUT_DIR + File.separator + "src-gen",
Expand Down Expand Up @@ -161,7 +161,7 @@ public class Works2 {
null /* standardJavaFileManager */,
Arrays.asList(
"-d", OUTPUT_DIR,
"-source", "1.6",
"-source", "1.8",
"-g", "-preserveAllLocals",
"-cp", OUTPUT_DIR + File.pathSeparator + _extJar.getAbsolutePath() ,
"-s", OUTPUT_DIR + File.separator + "src-gen",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.apt.tests.annotations.ProcessorTestStatus;
import org.eclipse.jdt.core.tests.util.Util;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;

public class AnnotationValueConversionTests extends APTTestBase
{
Expand Down Expand Up @@ -67,7 +68,7 @@ private IProject setupTest() throws Exception
{
ProcessorTestStatus.reset();
// project will be deleted by super-class's tearDown() method
IPath projectPath = env.addProject( getUniqueProjectName(), "1.5" ); //$NON-NLS-1$
IPath projectPath = env.addProject( getUniqueProjectName(), CompilerOptions.getFirstSupportedJavaVersion() ); //$NON-NLS-1$
env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$
env.addExternalJars( projectPath, Util.getJavaClassLibs() );
fullBuild( projectPath );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.tests.util.Util;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;

public class AptBuilderTests extends APTTestBase
{
Expand All @@ -53,7 +54,7 @@ public void setUp() throws Exception
// project will be deleted by super-class's tearDown() method
// create a project with a src directory as the project root directory
//
IPath projectPath = env.addProject( getProjectName_ProjectRootAsSrcDir(), "1.5" );
IPath projectPath = env.addProject( getProjectName_ProjectRootAsSrcDir(), CompilerOptions.getFirstSupportedJavaVersion() );
env.addExternalJars( projectPath, Util.getJavaClassLibs() );
fullBuild( projectPath );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.WorkingCopyOwner;
import org.eclipse.jdt.core.tests.model.ModifyingResourceTests;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;

public class AptReconcileTests extends ModifyingResourceTests
{
Expand Down Expand Up @@ -490,8 +491,8 @@ public void setUp() throws Exception
this._problemRequestor = new ProblemRequestor();

final IJavaProject project = createJavaProject( _testProject,
new String[] { "src" }, new String[] { "JCL15_LIB" },
"bin", "1.5" );
new String[] { "src" }, new String[] { "JCL18_LIB" },
"bin", CompilerOptions.getFirstSupportedJavaVersion() );
TestUtil.createAndAddAnnotationJar(project);
AptConfig.setEnabled(project, true);

Expand Down
Loading

0 comments on commit 3be7fa1

Please sign in to comment.