View | Details | Raw Unified | Return to bug 214731
Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java (-1 / +18 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 24-31 Link Here
24
24
25
import org.eclipse.core.resources.ResourcesPlugin;
25
import org.eclipse.core.resources.ResourcesPlugin;
26
import org.eclipse.jdt.core.JavaCore;
26
import org.eclipse.jdt.core.JavaCore;
27
import org.eclipse.jdt.core.compiler.CharOperation;
27
import org.eclipse.jdt.core.compiler.InvalidInputException;
28
import org.eclipse.jdt.core.compiler.InvalidInputException;
28
import org.eclipse.jdt.core.tests.util.Util;
29
import org.eclipse.jdt.core.tests.util.Util;
30
import org.eclipse.jdt.internal.compiler.batch.ClasspathJar;
29
import org.eclipse.jdt.internal.compiler.batch.ClasspathLocation;
31
import org.eclipse.jdt.internal.compiler.batch.ClasspathLocation;
30
import org.eclipse.jdt.internal.compiler.batch.Main;
32
import org.eclipse.jdt.internal.compiler.batch.Main;
31
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
33
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
Lines 7857-7862 Link Here
7857
		"invalid warning option: -warn:null,+unused. Must specify a warning token\n",
7859
		"invalid warning option: -warn:null,+unused. Must specify a warning token\n",
7858
		true);
7860
		true);
7859
}
7861
}
7862
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=214731
7863
// white-box test for internal API
7864
public void test216_batch_classpath_apis() {
7865
	assertFalse("path should be absolute", 
7866
		new ClasspathJar(new File("relative.jar"), true, null, null).
7867
		getPath().indexOf(File.separator) == -1);
7868
}
7869
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=214731
7870
// white-box test for internal API
7871
public void test217_batch_classpath_apis() {
7872
	assertFalse("path should be absolute", 
7873
		CharOperation.indexOf('/', 
7874
			new ClasspathJar(new File("relative.jar"), true, null, null).
7875
			normalizedPath()) == -1);
7876
}
7860
public static Class testClass() {
7877
public static Class testClass() {
7861
	return BatchCompilerTest.class;
7878
	return BatchCompilerTest.class;
7862
}
7879
}
(-)batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java (-4 / +6 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 31-37 Link Here
31
protected ZipFile zipFile;
31
protected ZipFile zipFile;
32
protected boolean closeZipFileAtEnd;
32
protected boolean closeZipFileAtEnd;
33
protected Hashtable packageCache;
33
protected Hashtable packageCache;
34
protected char[] normalizedPath;
35
34
36
public ClasspathJar(File file, boolean closeZipFileAtEnd, 
35
public ClasspathJar(File file, boolean closeZipFileAtEnd, 
37
		AccessRuleSet accessRuleSet, String destinationPath) {
36
		AccessRuleSet accessRuleSet, String destinationPath) {
Lines 133-139 Link Here
133
}
132
}
134
public char[] normalizedPath() {
133
public char[] normalizedPath() {
135
	if (this.normalizedPath == null) {
134
	if (this.normalizedPath == null) {
136
		char[] rawName = this.file.getPath().toCharArray();
135
		char[] rawName = this.file.getAbsolutePath().toCharArray();
137
		if (File.separatorChar == '\\') {
136
		if (File.separatorChar == '\\') {
138
			CharOperation.replace(rawName, '\\', '/');
137
			CharOperation.replace(rawName, '\\', '/');
139
		}
138
		}
Lines 142-147 Link Here
142
	return this.normalizedPath;
141
	return this.normalizedPath;
143
}
142
}
144
public String getPath(){
143
public String getPath(){
145
	return this.file.getPath();
144
	if (this.path == null) {
145
		this.path = this.file.getAbsolutePath();
146
	}
147
	return this.path;
146
}
148
}
147
}
149
}
(-)batch/org/eclipse/jdt/internal/compiler/batch/FileSystem.java (-4 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 36-44 Link Here
36
		 */
36
		 */
37
		void reset();
37
		void reset();
38
		/**
38
		/**
39
		 * Return a normalized path for file based classpath entries. This is an absolute path
39
		 * Return a normalized path for file based classpath entries. This is an
40
		 * ending with a file separator for directories, an absolute path deprived from the '.jar'
40
		 * absolute path in which file separators are transformed to the
41
		 * (resp. '.zip') extension for jar (resp. zip) files.
41
		 * platform-agnostic '/', ending with a '/' for directories. This is an 
42
		 * absolute path in which file separators are transformed to the
43
		 * platform-agnostic '/', deprived from the '.jar' (resp. '.zip') 
44
		 * extension for jar (resp. zip) files.
42
		 * @return a normalized path for file based classpath entries
45
		 * @return a normalized path for file based classpath entries
43
		 */
46
		 */
44
		char[] normalizedPath();
47
		char[] normalizedPath();
(-)batch/org/eclipse/jdt/internal/compiler/batch/ClasspathLocation.java (-2 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 22-28 Link Here
22
22
23
	public static final int SOURCE = 1;
23
	public static final int SOURCE = 1;
24
	public static final int BINARY = 2;
24
	public static final int BINARY = 2;
25
	
25
26
	String path;
27
	char[] normalizedPath;
26
	public AccessRuleSet accessRuleSet;
28
	public AccessRuleSet accessRuleSet;
27
29
28
	public String destinationPath;
30
	public String destinationPath;
(-)batch/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java (-3 / +1 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 24-31 Link Here
24
24
25
public class ClasspathDirectory extends ClasspathLocation {
25
public class ClasspathDirectory extends ClasspathLocation {
26
26
27
private char[] normalizedPath;
28
private String path;
29
private Hashtable directoryCache;
27
private Hashtable directoryCache;
30
private String[] missingPackageHolder = new String[1];
28
private String[] missingPackageHolder = new String[1];
31
private int mode; // ability to only consider one kind of files (source vs. binaries), by default use both
29
private int mode; // ability to only consider one kind of files (source vs. binaries), by default use both

Return to bug 214731