UnwovenClassFile classFile = new UnwovenClassFile(new File(outDir, filename).getAbsolutePath(), bytes);
if (filename.endsWith(".class")) {
- this.addClassFile(classFile,false);
+ ReferenceType type = this.addClassFile(classFile,false);
+// StringBuffer sb = new StringBuffer();
+// sb.append(inFile.getAbsolutePath());
+// sb.append("!");
+// sb.append(entry.getName());
+// type.setBinaryPath(sb.toString());
addedClassFiles.add(classFile);
}
// else if (!entry.isDirectory()) {
/**
* Should be addOrReplace
*/
- public void addClassFile(UnwovenClassFile classFile, boolean fromInpath) {
+ public ReferenceType addClassFile(UnwovenClassFile classFile, boolean fromInpath) {
addedClasses.add(classFile);
// if (null != sourceJavaClasses.put(classFile.getClassName(),
// classFile)) {
if (fromInpath) {
type.setBinaryPath(classFile.getFilename());
}
+ return type;
}
public UnwovenClassFile addClassFile(File classFile, File inPathDir, File outDir) throws IOException {
if (filename.endsWith(".class")) {
// System.err.println(
// "BCELWeaver: processing class from input directory "+classFile);
- this.addClassFile(ucf,true);
+ StringBuffer sb = new StringBuffer();
+ sb.append(inPathDir.getAbsolutePath());
+ sb.append("!");
+ sb.append(filename);
+ ReferenceType type = this.addClassFile(ucf,false);
+ type.setBinaryPath(sb.toString());
}
fis.close();
return ucf;
// /; - the semicolon is a 'well defined char' that means inpath
phantomHandle.append(HandleProviderDelimiter.PACKAGEFRAGMENTROOT.getDelimiter()).append(';');
+ int pos = bpath.indexOf('!');
+ if (pos != -1) {
+ // jar or dir
+ String jarPath = bpath.substring(0,pos);
+ String element = model.getHandleElementForInpath(jarPath);
+ if (element!=null) {
+ phantomHandle.append(element);
+ }
+ }
+
// <g
String packageName = onType.getPackageName();
phantomHandle.append(HandleProviderDelimiter.PACKAGEFRAGMENT.getDelimiter()).append(packageName);
-
+
// (G.class
// could fix the binary path to only be blah.class bit
int dotClassPosition = bpath.lastIndexOf(".class");// what to do if -1
} else {
int startPosition = dotClassPosition;
char ch;
- while (startPosition>0 && ((ch=bpath.charAt(startPosition))!='/' && ch!='\\')) {
+ while (startPosition>0 && ((ch=bpath.charAt(startPosition))!='/' && ch!='\\' && ch!='!')) {
startPosition--;
}
String classFile = bpath.substring(startPosition+1,dotClassPosition+6);