Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8066761

Investigate -sourcepath usage when compiling java

XMLWordPrintable

    • b41
    • b43

        When using 8u25 as boot, and with a non fresh clone of jdk9/dev, it's possible to get the following build error:

        >>>>>>>>>>
        Compiling 23 files for BUILD_INTERIM_JIMAGE
        /Users/src/jdk-dev/jdk9-dev/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java:230: error: cannot find symbol
                    LambdaForm form2 = mh.editor().filterArgumentForm(1+i, BasicType.basicType(newType));
                                         ^
          symbol: method editor()
          location: variable mh of type BoundMethodHandle
        ...
        >>>>>>>>>>

        This is caused by trying to compile a subset of java.base java source with -source/-target 8 and setting -sourcepath to /Users/src/jdk-dev/jdk9-dev/jdk/src/java.base/share/classes. Which classes to link to will depend on timestamps on the source and in the rt.jar in the boot jdk. A workaround is to touch all source files in java.base, but that will actually be incorrect as it will be linking to the jdk9 classes instead of the boot jdk classes.

        We have a method for fixing these issues in the build, by setting sourcepath to something more specific, effectively excluding everything we aren't compiling. However, we also question the need for setting -sourcepath. We need to figure out why it was set in the first place and if it's still needed in any situation.

              erikj Erik Joelsson
              erikj Erik Joelsson
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: