Commit 7323d7a7 authored by andrei's avatar andrei

A very naive attempt to lookup Java 9 library class files. It works but is *slow*.

Requires to bump the plugin to Java 8, and so update the version too.
parent 00d70753
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
<accessrule kind="accessible" pattern="**/jdt/internal/**"/> <accessrule kind="accessible" pattern="**/jdt/internal/**"/>
</accessrules> </accessrules>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>
...@@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul ...@@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
...@@ -121,7 +121,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning ...@@ -121,7 +121,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,HIGH org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,HIGH
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX
......
...@@ -2,7 +2,7 @@ Manifest-Version: 1.0 ...@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: Bytecode Outline Bundle-Name: Bytecode Outline
Bundle-SymbolicName: de.loskutov.BytecodeOutline;singleton:=true Bundle-SymbolicName: de.loskutov.BytecodeOutline;singleton:=true
Bundle-Version: 2.4.3 Bundle-Version: 2.5.0
Bundle-ClassPath: ., Bundle-ClassPath: .,
lib/asm-debug-all.jar lib/asm-debug-all.jar
Bundle-Activator: de.loskutov.bco.BytecodeOutlinePlugin Bundle-Activator: de.loskutov.bco.BytecodeOutlinePlugin
...@@ -22,5 +22,5 @@ Require-Bundle: org.eclipse.ui, ...@@ -22,5 +22,5 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.jdt.debug, org.eclipse.jdt.debug,
org.junit;resolution:=optional org.junit;resolution:=optional
Eclipse-LazyStart: true Eclipse-LazyStart: true
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
<fileset dir="${eclipse.home}" includes="plugins/**/*.jar"/> <fileset dir="${eclipse.home}" includes="plugins/**/*.jar"/>
</path> </path>
<mkdir dir="${out.build}"/> <mkdir dir="${out.build}"/>
<javac destdir="${out.build}" debug="on" source="1.6" target="1.6" includeantruntime="false"> <javac destdir="${out.build}" debug="on" source="1.8" target="1.8" includeantruntime="false">
<classpath refid="classpath"/> <classpath refid="classpath"/>
<src path="${src}"/> <src path="${src}"/>
<include name="**/*.java"/> <include name="**/*.java"/>
......
...@@ -15,8 +15,14 @@ import java.io.FileNotFoundException; ...@@ -15,8 +15,14 @@ import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL; import java.net.URL;
import java.net.URLClassLoader; import java.net.URLClassLoader;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
...@@ -24,6 +30,7 @@ import java.util.IdentityHashMap; ...@@ -24,6 +30,7 @@ import java.util.IdentityHashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.jar.JarEntry; import java.util.jar.JarEntry;
import java.util.jar.JarFile; import java.util.jar.JarFile;
...@@ -968,6 +975,24 @@ public class JdtUtils { ...@@ -968,6 +975,24 @@ public class JdtUtils {
BytecodeOutlinePlugin.log(e, IStatus.ERROR); BytecodeOutlinePlugin.log(e, IStatus.ERROR);
} }
} }
if(path.lastSegment().equals("jrt-fs.jar")){
URL url;
try {
url = Paths.get(path.toOSString()).toUri().toURL();
URLClassLoader loader = new URLClassLoader(new URL[] { url });
FileSystem fs = FileSystems.newFileSystem(URI.create("jrt:/"),
Collections.emptyMap(),
loader);
Path top = fs.getPath("/");
Optional<Path> first = Files.walk(top).filter(Files::isRegularFile).filter(p -> p.endsWith(fullClassName)).findFirst();
if(first.isPresent()){
return Files.newInputStream(first.get());
}
} catch (IOException e) {
e.printStackTrace();
}
}
return null; return null;
} }
......
...@@ -319,6 +319,9 @@ public class BytecodeOutlineView extends ViewPart { ...@@ -319,6 +319,9 @@ public class BytecodeOutlineView extends ViewPart {
} }
private void checkVerifyMode() { private void checkVerifyMode() {
if(toggleVerifierAction == null){
return;
}
boolean aoi = JdtUtils.isAbstractOrInterface(javaInput); boolean aoi = JdtUtils.isAbstractOrInterface(javaInput);
if (!toggleVerifierAction.isChecked()) { if (!toggleVerifierAction.isChecked()) {
...@@ -414,7 +417,10 @@ public class BytecodeOutlineView extends ViewPart { ...@@ -414,7 +417,10 @@ public class BytecodeOutlineView extends ViewPart {
statusLineManager = new StatusLineManager(); statusLineManager = new StatusLineManager();
statusControl = statusLineManager.createControl(parent, SWT.NONE); statusControl = statusLineManager.createControl(parent, SWT.NONE);
statusControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); statusControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
IEditorPart activeEditor = EclipseUtils.getActiveEditor();
if(activeEditor instanceof ITextEditor) {
setInput((ITextEditor) activeEditor);
}
createTextControl(); createTextControl();
createTextContextMenu(); createTextContextMenu();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment