Java 为什么JD-GUI在每一行前面加上注释和行号?

Java 为什么JD-GUI在每一行前面加上注释和行号?,java,decompiling,jad,jd-gui,Java,Decompiling,Jad,Jd Gui,这个问题我已经遇到好几次了。每当我使用JD-GUI反编译某些东西并保存所有源代码时,它都会在每行前面加上一个块注释,并在方法体中插入代码行号。下面是我刚刚反编译的一个jar示例: /* */ public void onEnable() /* */ { /* 25 */ List DropList = new ArrayList(); /* 26 */ DropList.add(Integer.valueOf(264)); /* 27 */ DropL

这个问题我已经遇到好几次了。每当我使用JD-GUI反编译某些东西并保存所有源代码时,它都会在每行前面加上一个块注释,并在方法体中插入代码行号。下面是我刚刚反编译的一个jar示例:

/*    */   public void onEnable()
/*    */   {
/* 25 */     List DropList = new ArrayList();
/* 26 */     DropList.add(Integer.valueOf(264));
/* 27 */     DropList.add(Integer.valueOf(57));
/* 28 */     DropList.add(Integer.valueOf(278));
/*    */ 
/* 30 */     this.config = getConfig();
/*    */ 
/* 32 */     this.config.addDefault("GiftDrops", DropList);
/* 33 */     this.config.addDefault("DropRate", Integer.valueOf(0));
/* 34 */     this.config.addDefault("GiftBoxPlayerSkin", "lol768");
/* 35 */     this.config.addDefault("CraftingRecipe.LineOne", "339,339,339");
/* 36 */     this.config.addDefault("CraftingRecipe.LineTwo", "339,264,339");
/* 37 */     this.config.addDefault("CraftingRecipe.LineThree", "339,339,339");
/*    */ 
/* 39 */     this.config.options().copyDefaults(true);
/* 40 */     saveConfig();
/*    */ 
/* 43 */     SkullMeta giftboxskull = (SkullMeta)this.giftbox.getItemMeta();
/*    */ 
/* 45 */     giftboxskull.setOwner(this.config.getString("GiftBoxPlayerSkin"));
/* 46 */     giftboxskull.setDisplayName(ChatColor.GREEN + "Gift Box");
/* 47 */     this.giftbox.setItemMeta(giftboxskull);
/*    */ 
/* 49 */     this.giftboxrecipe = new ShapedRecipe(this.giftbox);
/* 50 */     this.giftboxrecipe.shape(new String[] { "123", "456", "789" });
/*    */ 
/* 52 */     String[] LineOne = getConfig().getString("CraftingRecipe.LineOne").split(",");
/* 53 */     String[] LineTwo = getConfig().getString("CraftingRecipe.LineTwo").split(",");
/* 54 */     String[] LineThree = getConfig().getString("CraftingRecipe.LineThree").split(",");
/*    */ 
/* 56 */     this.giftboxrecipe.setIngredient('1', new ItemStack(Integer.parseInt(LineOne[0])).getData());
/* 57 */     this.giftboxrecipe.setIngredient('2', new ItemStack(Integer.parseInt(LineOne[1])).getData());
/* 58 */     this.giftboxrecipe.setIngredient('3', new ItemStack(Integer.parseInt(LineOne[2])).getData());
/* 59 */     this.giftboxrecipe.setIngredient('4', new ItemStack(Integer.parseInt(LineTwo[0])).getData());
/* 60 */     this.giftboxrecipe.setIngredient('5', new ItemStack(Integer.parseInt(LineTwo[1])).getData());
/* 61 */     this.giftboxrecipe.setIngredient('6', new ItemStack(Integer.parseInt(LineTwo[2])).getData());
/* 62 */     this.giftboxrecipe.setIngredient('7', new ItemStack(Integer.parseInt(LineThree[0])).getData());
/* 63 */     this.giftboxrecipe.setIngredient('8', new ItemStack(Integer.parseInt(LineThree[1])).getData());
/* 64 */     this.giftboxrecipe.setIngredient('9', new ItemStack(Integer.parseInt(LineThree[2])).getData());
/*    */ 
/* 66 */     getServer().addRecipe(this.giftboxrecipe);
/*    */ 
/* 68 */     getServer().getPluginManager().registerEvents(new GiftBoxEventListener(this), this);
/*    */   }

这似乎是JD-GUI阻止人们使用通过编译获得的源文件的一个功能。我可以使用bash命令相当容易地删除所有这些注释,但这仍然是一个麻烦。有没有办法禁用此功能?

在“帮助”->“首选项”中的“源代码保存”组下,取消选中“显示行号”

谢谢,这很有效。我之前看到过这个选项,但我认为它是用于GUI中代码旁边显示的行号,而不是保存的源代码中的行号。我很好奇:为什么你称它为“问题”,并得出这样一个不可计算的结论?首先:它不会阻止你编译文件;即使有评论,他们也能很好地编译。为什么JD-GUI会关心您是否编译它创建的源代码?它们不是它们的来源。我很清楚它为什么会这样做:因为它很方便,特别是在调试方面。堆栈跟踪和调试信息包含行号,知道在调试过程中发生异常的第三方代码的哪一行或程序指针的位置非常有用……我同意有时这很烦人。例如,如果您想反编译同一jar的两个版本,并使用合并工具比较它们。一个类文件中的一个额外行将导致文件中的每一行显示为不同的。祖福柳的回答真的帮助了我!