Skip to content

Commit

Permalink
Merge pull request #3198 from eclipse/cd-betterworkaround
Browse files Browse the repository at this point in the history
better workaround for inlineJsrBytecode jdt removal
  • Loading branch information
cdietrich authored Sep 17, 2024
2 parents 44d7164 + 0750638 commit fb12a54
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 21 deletions.
4 changes: 1 addition & 3 deletions org.eclipse.xtext.java/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ Require-Bundle: org.eclipse.xtext;bundle-version="2.37.0",
org.eclipse.xtend.lib;bundle-version="2.37.0",
org.eclipse.jdt.core;bundle-version="3.29.0",
org.eclipse.emf.common;bundle-version="2.24.0",
org.eclipse.emf.ecore;bundle-version="2.26.0",
org.eclipse.core.runtime;visibility:=reexport,
org.eclipse.core.resources;visibility:=reexport
org.eclipse.emf.ecore;bundle-version="2.26.0"
Export-Package: org.eclipse.xtext.java;version="2.37.0",
org.eclipse.xtext.java.resource;version="2.37.0"
Import-Package: org.apache.log4j;version="1.2.24"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ClassFile;
import org.eclipse.jdt.internal.compiler.CompilationResult;
Expand Down Expand Up @@ -56,7 +55,6 @@
import org.eclipse.xtext.util.JavaVersion;
import org.eclipse.xtext.xbase.lib.Exceptions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure2;
import org.osgi.framework.Version;

import com.google.inject.Inject;

Expand Down Expand Up @@ -304,11 +302,7 @@ protected CompilerOptions getCompilerOptions(JavaConfig javaConfig) {
private final static MethodHandle INLINE_JSR_BYTECODE = findInlineJsrBytecode();
private static MethodHandle findInlineJsrBytecode() {
try {
if (JavaCore.getPlugin().getBundle().getVersion().compareTo(new Version(3, 39, 100)) >= 0) {
return null;
} else {
return MethodHandles.lookup().findSetter(CompilerOptions.class, "inlineJsrBytecode", boolean.class);
}
return MethodHandles.lookup().findSetter(CompilerOptions.class, "inlineJsrBytecode", boolean.class);
} catch (Exception e) {
return null;
}
Expand Down
3 changes: 1 addition & 2 deletions org.eclipse.xtext.xbase.testing/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ Require-Bundle: org.eclipse.xtext;bundle-version="2.37.0",
org.eclipse.jdt.core;bundle-version="3.29.0";visibility:=reexport,
org.junit;bundle-version="4.13.2",
org.eclipse.xtext.testing;bundle-version="2.37.0",
org.eclipse.core.runtime;bundle-version="3.24.100";visibility:=reexport,
org.eclipse.core.resources;visibility:=reexport
org.eclipse.core.runtime;bundle-version="3.24.100"
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.xtext.xbase.testing;version="2.37.0",
org.eclipse.xtext.xbase.testing.evaluation;version="2.37.0";x-friends:="org.eclipse.xtext.xbase.tests,org.eclipse.xtext.purexbase.tests,org.eclipse.xtend.core.tests",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@
import java.net.URLConnection;
import java.net.URLStreamHandler;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.log4j.Logger;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.compiler.CategorizedProblem;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ClassFile;
Expand All @@ -41,10 +39,8 @@
import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
import org.eclipse.jdt.internal.core.JavaModelManager.PerProjectInfo;
import org.eclipse.xtext.util.JavaVersion;
import org.eclipse.xtext.xbase.lib.Exceptions;
import org.osgi.framework.Version;

import com.google.common.collect.Lists;

Expand Down Expand Up @@ -223,11 +219,7 @@ public InMemoryJavaCompiler(ClassLoader parent, JavaVersion javaVersion) {
private final static MethodHandle INLINE_JSR_BYTECODE = findInlineJsrBytecode();
private static MethodHandle findInlineJsrBytecode() {
try {
if (JavaCore.getPlugin().getBundle().getVersion().compareTo(new Version(3, 39, 100)) >= 0) {
return null;
} else {
return MethodHandles.lookup().findSetter(CompilerOptions.class, "inlineJsrBytecode", boolean.class);
}
return MethodHandles.lookup().findSetter(CompilerOptions.class, "inlineJsrBytecode", boolean.class);
} catch (Exception e) {
return null;
}
Expand Down

0 comments on commit fb12a54

Please sign in to comment.