diff options
author | Stephan Herrmann | 2018-02-15 19:32:24 +0000 |
---|---|---|
committer | Stephan Herrmann | 2018-02-15 19:32:24 +0000 |
commit | b1610eaae0a778a35578b340fad9351bd90c7b39 (patch) | |
tree | 420051b32eff307a43e404bbc6bf8f39afe8b4fc | |
parent | b970fee63ce679d80b7e665b70dcbd93d014a258 (diff) | |
download | eclipse.jdt.core-I20180216-2000.tar.gz eclipse.jdt.core-I20180216-2000.tar.xz eclipse.jdt.core-I20180216-2000.zip |
Change-Id: Ib51b7054d350c2c0e52b36f89391511668f3da55
3 files changed, 6 insertions, 28 deletions
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java index 4227b6782f..06ab4b6a1f 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -226,21 +226,7 @@ private IBinaryType getJarBinaryTypeInfo() throws CoreException, IOException, Cl String entryName = jarRoot.getClassFilePath(Util.concatWith(pkg.names, getElementName(), '/')); byte[] contents = getClassFileContent(jarRoot, entryName); if (contents != null) { - String fileName; - String rootPath = root.getPath().toOSString(); - String rootIdentifier = root.getHandleIdentifier(); - if (org.eclipse.jdt.internal.compiler.util.Util.isJrt(rootPath)) { - int slash = rootIdentifier.lastIndexOf('/'); - if (slash != -1) { - StringBuilder extract = new StringBuilder(); - extract.append(rootIdentifier.substring(0, slash)); - int modStart = rootIdentifier.indexOf(JavaElement.JEM_MODULE); - if (modStart != -1) - extract.append(rootIdentifier.substring(modStart)); - rootIdentifier = extract.toString(); - } - } - fileName = rootIdentifier + IDependent.JAR_FILE_ENTRY_SEPARATOR + entryName; + String fileName = root.getHandleIdentifier() + IDependent.JAR_FILE_ENTRY_SEPARATOR + entryName; result = new ClassFileReader(contents, fileName.toCharArray(), false); } } else { diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ModularClassFile.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ModularClassFile.java index 0f00d8a466..4766281114 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ModularClassFile.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ModularClassFile.java @@ -167,15 +167,7 @@ public class ModularClassFile extends AbstractClassFile implements IModularClass String entryName = jarRoot.getClassFilePath(Util.concatWith(pkg.names, getElementName(), '/')); byte[] contents = getClassFileContent(jarRoot, entryName); if (contents != null) { - String fileName; - String rootPath = root.getPath().toOSString(); - String rootIdentifier = root.getHandleIdentifier(); - if (org.eclipse.jdt.internal.compiler.util.Util.isJrt(rootPath)) { - int slash = rootIdentifier.lastIndexOf('/'); - if (slash != -1) - rootIdentifier = rootIdentifier.substring(0, slash); - } - fileName = rootIdentifier + IDependent.JAR_FILE_ENTRY_SEPARATOR + entryName; + String fileName = root.getHandleIdentifier() + IDependent.JAR_FILE_ENTRY_SEPARATOR + entryName; ClassFileReader classFileReader = new ClassFileReader(contents, fileName.toCharArray(), false); return classFileReader.getModuleDeclaration(); } diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java index 47e44edddc..1d37cba603 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -752,7 +752,7 @@ public class Util { } private static IClassFile getClassFile(char[] fileName) { - int jarSeparator = CharOperation.lastIndexOf(IDependent.JAR_FILE_ENTRY_SEPARATOR, fileName); + int jarSeparator = CharOperation.indexOf(IDependent.JAR_FILE_ENTRY_SEPARATOR, fileName); int pkgEnd = CharOperation.lastIndexOf('/', fileName); // pkgEnd is exclusive if (pkgEnd == -1) pkgEnd = CharOperation.lastIndexOf(File.separatorChar, fileName); @@ -1485,7 +1485,7 @@ public class Util { if (referenceBinding.isLocalType() || referenceBinding.isAnonymousType()) { // local or anonymous type if (org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(fileName)) { - int jarSeparator = CharOperation.lastIndexOf(IDependent.JAR_FILE_ENTRY_SEPARATOR, fileName); + int jarSeparator = CharOperation.indexOf(IDependent.JAR_FILE_ENTRY_SEPARATOR, fileName); int pkgEnd = CharOperation.lastIndexOf('/', fileName); // pkgEnd is exclusive if (pkgEnd == -1) pkgEnd = CharOperation.lastIndexOf(File.separatorChar, fileName); |