Иерархии каталогов должны соответствовать иерархиям пакетов - PullRequest
0 голосов
/ 01 июля 2019

Я получаю следующую ошибку, пытаясь запутать свою Java-программу (плагин spigot API для сервера minecraft)

Note: you're writing the processed class files to a directory [C:\Users\user\Desktop\OBFUSCATE\out].
      This will likely cause problems with obfuscated mixed-case class names.
      You should consider writing the output to a jar file, or otherwise
      specify '-dontusemixedcaseclassnames'.
Reading program jar [C:\Users\user\Desktop\OBFUSCATE\pvptimer.jar]
Reading library jar [C:\Program Files\Java\jdk1.8.0_211\jre\lib\rt.jar]
Reading library jar [C:\Users\user\Desktop\OBFUSCATE\paper-1613.jar]
Warning: class [META-INF/versions/9/com/destroystokyo/paperclip/Main.class] unexpectedly contains class [com.destroystokyo.paperclip.Main]
Note: duplicate definition of library class [com.destroystokyo.paperclip.Main]
Warning: class [META-INF/versions/9/com/destroystokyo/paperclip/Agent.class] unexpectedly contains class [com.destroystokyo.paperclip.Agent]
Note: duplicate definition of library class [com.destroystokyo.paperclip.Agent]
Reading library jar [C:\Users\user\Desktop\OBFUSCATE\patched_1.12.2.jar]
Note: duplicate definition of library class [org.json.simple.ItemList]
Note: duplicate definition of library class [org.json.simple.JSONArray]
Note: duplicate definition of library class [org.json.simple.JSONAware]
Note: duplicate definition of library class [org.json.simple.JSONObject]
Note: duplicate definition of library class [org.json.simple.JSONStreamAware]
Note: duplicate definition of library class [org.json.simple.JSONValue]
Note: duplicate definition of library class [org.json.simple.parser.ContainerFactory]
Note: duplicate definition of library class [org.json.simple.parser.ContentHandler]
Note: duplicate definition of library class [org.json.simple.parser.JSONParser]
Note: duplicate definition of library class [org.json.simple.parser.ParseException]
Note: duplicate definition of library class [org.json.simple.parser.Yylex]
Note: duplicate definition of library class [org.json.simple.parser.Yytoken]
Note: there were 14 duplicate class definitions.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
Warning: there were 2 classes in incorrectly named files.
         You should make sure all file names correspond to their class names.
         The directory hierarchies must correspond to the package hierarchies.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unexpectedclass)
         If you don't mind the mentioned classes not being written out,
         you could try your luck using the '-ignorewarnings' option.
Please correct the above warnings first.

Я просто не уверен, как исправить эту ошибку.Я просмотрел и нашел несколько онлайн-уроков, в которых утверждается, что они могут решить эту проблему, но безрезультатно.

Если кто-то сталкивался с этой проблемой и смог ее исправить, поделитесь своей мудростью!

Редактировать **:

После выбора поля Ignore warnings about possibly erroneous input обфускация проходит, но при загрузке плагина я получаю эту ошибку:

image

1 Ответ

2 голосов
/ 01 июля 2019

Это, скорее всего, связано с библиотеками, от которых зависит ваш код, или от того, какой другой код в вашем проекте зависит от вашего теперь обфусцированного кода, однако его ссылки указывают на имена методов необфускацированного jar. Дайте мне знать, если тот пролетел мимо вашей головы, я постараюсь объяснить это немного лучше, если смогу.

Небольшой пример:

OldClass { //This class, has reference to LibClass.callMethod
   void oldMethod() { 
     LibClass.callMethod(); 
   }
}

LibClass {
   static void callMethod() { 
      //now if this gets obfuscated, 
      //and the above code is never renamed to this new obfuscated name
      // you will get errors like you are seeing (The method doesn't exist anymore)

   }
}
...