No Description

show_bug.sh 1.3KB

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. # delete all classes
  3. rm -f *.class
  4. javac -version 2>&1
  5. # compile our annotation processor once
  6. javac ParameterPrintingProcessor.java
  7. echo 'these are the correct argument names, compiled with and without -parameters argument, compiling both classes in a single invocation:'
  8. javac -parameters -processor ParameterPrintingProcessor Person.java PersonDao.java 2>&1 | head -n1
  9. rm Person.class PersonDao.class
  10. javac -processor ParameterPrintingProcessor Person.java PersonDao.java 2>&1 | head -n1
  11. echo
  12. echo 'this shows expected missing parameter names when compiled in 2 steps, like in the case of libraries or multiple module projects, without -parameters:'
  13. rm Person.class PersonDao.class
  14. javac Person.java
  15. javac -processor ParameterPrintingProcessor PersonDao.java 2>&1 | head -n1
  16. echo
  17. echo 'and finally the bug, same two step compilation as above, but -parameters passed into first step, shows shifted/incorrect parameter names:'
  18. rm Person.class PersonDao.class
  19. javac -parameters Person.java
  20. # below is the actual invocation of javac where the bug lives, somehow reads saved parameter names from step above incorrectly
  21. # they are saved correctly above, because you can read them at runtime correctly
  22. javac -processor ParameterPrintingProcessor PersonDao.java 2>&1 | head -n1
  23. # clean up by deleting all classes
  24. rm -f *.class