Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2018-02-15 19:32:24 +0000
committerStephan Herrmann2018-03-20 17:01:24 +0000
commitfd1dbb02407230932d3c315667ec6d8282cc6299 (patch)
tree71fbfe090325a92cdcd0d58d3519c19c1f5406ec
parent604e0d84e4cabe094be7914b63bbb589ac97df73 (diff)
downloadeclipse.jdt.core-fd1dbb02407230932d3c315667ec6d8282cc6299.tar.gz
eclipse.jdt.core-fd1dbb02407230932d3c315667ec6d8282cc6299.tar.xz
eclipse.jdt.core-fd1dbb02407230932d3c315667ec6d8282cc6299.zip
Bug 530308 - [9] check usage of ClassFileReader.classFileName
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java11
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ModularClassFile.java9
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java6
3 files changed, 6 insertions, 20 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 0b60457869..4f631e6c4e 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
@@ -225,14 +225,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();
- if (org.eclipse.jdt.internal.compiler.util.Util.isJrt(rootPath)) {
- fileName = root.getHandleIdentifier() + IDependent.JAR_FILE_ENTRY_SEPARATOR +
- root.getElementName() + IDependent.JAR_FILE_ENTRY_SEPARATOR + entryName;
- } else {
- fileName = root.getHandleIdentifier() + 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 df08044e18..247403a8ce 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
@@ -166,14 +166,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();
- if (org.eclipse.jdt.internal.compiler.util.Util.isJrt(rootPath)) {
- fileName = root.getHandleIdentifier() + IDependent.JAR_FILE_ENTRY_SEPARATOR +
- root.getElementName() + IDependent.JAR_FILE_ENTRY_SEPARATOR + entryName;
- } else {
- fileName = root.getHandleIdentifier() + 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 2a31f706a7..2ec8896aa5 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);

Back to the top