Uses 1311K of libraries. Click here for Pure Java version (493L/4K/12K).
!759 lib 1004055 import org.apache.bcel.classfile.ClassParser; import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.classfile.Attribute; import org.apache.bcel.classfile.SourceFile; import org.apache.bcel.generic.*; p { JavaClass c = new ClassParser ( main.class.getResourceAsStream("/main.class"), "main.class").parse(); print(c.getSourceFileName()); ClassGen g = new ClassGen(c); S newName = parseSnippetID(programID()) + ".javax"; int nameIndex = g.getConstantPool().addUtf8(newName); for (Attribute attr : g.getAttributes()) if (attr instanceof SourceFile) { g.removeAttribute(attr); break; } g.addAttribute(new SourceFile( g.getConstantPool().addUtf8("SourceFile"), 2, nameIndex, g.getConstantPool().getConstantPool())); c = g.getJavaClass(); File f; c.dump(f = prepareProgramFile("main.class")); c = new ClassParser (f.getPath()).parse(); print(c.getSourceFileName()); }
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1004056 |
Snippet name: | BCEL - change source file name within .class - seems to work |
Eternal ID of this version: | #1004056/1 |
Text MD5: | b7e725761c703f2aa58b958e25979c49 |
Transpilation MD5: | e47f417a70051c3b8154d668a45b4110 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-08-05 14:38:02 |
Source code size: | 1014 bytes / 39 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 628 / 673 |
Referenced in: | [show references] |