While exploring Jenkins 2.60.3 on Oracle Java 9 build 181 (pre-release), it reports illegal access exceptions and warns that a future release of Java 9 will forbid illegal access.

      A partial stack trace shows:

      WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/var/jenkins_home/war/WEB-INF/lib/xstream-1.4.7-jenkins-1.jar) to field java.util.TreeMap.comparator
              at com.thoughtworks.xstream.core.util.Fields.locate(Fields.java:39)
              at com.thoughtworks.xstream.converters.collections.TreeMapConverter.<clinit>(TreeMapConverter.java:50)
              at com.thoughtworks.xstream.XStream.setupConverters(XStream.java:811)
              at com.thoughtworks.xstream.XStream.<init>(XStream.java:574)
      
      WARNING: Illegal reflective access by com.thoughtworks.xstream.converters.reflection.FieldDictionary (file:/var/jenkins_home/war/WEB-INF/lib/xstream-1.4.7-jenkins-1.jar) to field java.util.Collections$EmptyList.serialVersionUID
              at com.thoughtworks.xstream.converters.reflection.FieldDictionary.buildMap(FieldDictionary.java:148)
              at com.thoughtworks.xstream.converters.reflection.FieldDictionary.fieldsFor(FieldDictionary.java:76)
              at com.thoughtworksxstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:130)
      

      Similar warnings appear for FieldDictionary references

      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.AbstractCollection.MAX_ARRAY_SIZE
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.AbstractList.modCount
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.AbstractMap.keySet
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.AbstractMap.values
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.Arrays$ArrayList.a
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.Arrays$ArrayList.serialVersionUID
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.Collections$EmptyList.serialVersionUID
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.Collections$UnmodifiableCollection.c
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.Collections$UnmodifiableCollection.serialVersionUID
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.Collections$UnmodifiableList.list
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.Collections$UnmodifiableList.serialVersionUID
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.Collections$UnmodifiableSet.serialVersionUID
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.concurrent.ConcurrentSkipListMap.BASE_HEADER
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.concurrent.ConcurrentSkipListMap.comparator
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.concurrent.ConcurrentSkipListMap.descendingMap
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.concurrent.ConcurrentSkipListMap.entrySet
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.concurrent.ConcurrentSkipListMap.EQ
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.concurrent.ConcurrentSkipListMap.GT
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.concurrent.ConcurrentSkipListMap.head
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.concurrent.ConcurrentSkipListMap.HEAD
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.concurrent.ConcurrentSkipListMap.keySet
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.concurrent.ConcurrentSkipListMap.LT
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.concurrent.ConcurrentSkipListMap.serialVersionUID
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.concurrent.ConcurrentSkipListMap.values
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.TreeMap.BLACK
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.TreeMap.comparator
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.TreeMap.descendingMap
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.TreeMap.entrySet
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.TreeMap.modCount
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.TreeMap.navigableKeySet
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.TreeMap.RED
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.TreeMap.root
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.TreeMap.serialVersionUID
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.TreeMap.size
      WARNING: Illegal reflective access by ...reflection.FieldDictionary to field java.util.TreeMap.UNBOUNDED
      

      Similar warnings appear for Field references

      WARNING: Illegal reflective access by ...core.util.Fields to field java.awt.font.TextAttribute.instanceMap
      WARNING: Illegal reflective access by ...core.util.Fields to field java.lang.reflect.Proxy.h
      WARNING: Illegal reflective access by ...core.util.Fields to field java.util.EnumMap.keyType
      WARNING: Illegal reflective access by ...core.util.Fields to field java.util.EnumSet.elementType
      WARNING: Illegal reflective access by ...core.util.Fields to field java.util.Properties.defaults
      WARNING: Illegal reflective access by ...core.util.Fields to field java.util.TreeMap.comparator
      WARNING: Illegal reflective access by ...core.util.Fields to field java.util.TreeSet.m
      

      Similar warnings appear for SerializableConverter references

      WARNING: Illegal reflective access by ...reflection.SerializableConverter to field java.util.concurrent.ConcurrentSkipListMap.comparator
      WARNING: Illegal reflective access by ...reflection.SerializableConverter to field java.util.TreeMap.comparator
      

      Method access warnings appear in SerializationMethodInvoker for:

      WARNING: Illegal reflective access by ...reflection.SerializationMethodInvoker to method java.util.Collections$EmptyList.readResolve()
      WARNING: Illegal reflective access by ...reflection.SerializationMethodInvoker to method java.util.Collections$UnmodifiableList.readResolve()
      WARNING: Illegal reflective access by ...reflection.SerializationMethodInvoker to method java.util.concurrent.ConcurrentSkipListMap.readObject(java.io.ObjectInputStream)
      WARNING: Illegal reflective access by ...reflection.SerializationMethodInvoker to method java.util.concurrent.ConcurrentSkipListMap.writeObject(java.io.ObjectOutputStream)
      WARNING: Illegal reflective access by ...reflection.SerializationMethodInvoker to method java.util.TreeMap.readObject(java.io.ObjectInputStream)
      WARNING: Illegal reflective access by ...reflection.SerializationMethodInvoker to method java.util.TreeMap.writeObject(java.io.ObjectOutputStream)
      

      Method access warnings appear in AbstractAttributedCharacterIteratorAttributeConverter for:

      WARNING: Illegal reflective access by ...reflection.AbstractAttributedCharacterIteratorAttributeConverter to method java.text.AttributedCharacterIterator$Attribute.getName()
      

          [JENKINS-46615] [JDK9] Illegal reflective access from xstream

          Added a link to Nicolas' upstream ticket

          Kohsuke Kawaguchi added a comment - Added a link  to Nicolas' upstream ticket

          Chris Kilding added a comment -

          I saw this same error today when running tests on a fresh checkout of a plugin with a passing CI build.

          It turned out that when I had run `brew update maven` earlier, Homebrew also updated Maven's transitive `openjdk` dependency to JDK 16. I didn't notice at the time; only when I ran the plugin's test suite, which includes Xstream, did it become apparent.

          This comment https://github.com/x-stream/xstream/issues/101#issuecomment-722701986 suggests that Xstream might have been fixed in the years since Mark filed the ticket. If so we should get round to updating Jenkins' Xstream dependencies.

          Chris Kilding added a comment - I saw this same error today when running tests on a fresh checkout of a plugin with a passing CI build. It turned out that when I had run `brew update maven` earlier, Homebrew also updated Maven's transitive `openjdk` dependency to JDK 16. I didn't notice at the time; only when I ran the plugin's test suite, which includes Xstream, did it become apparent. This comment https://github.com/x-stream/xstream/issues/101#issuecomment-722701986  suggests that Xstream might have been fixed in the years since Mark filed the ticket. If so we should get round to updating Jenkins' Xstream dependencies.

          Mark Waite added a comment -

          Thanks for the feedback chriskilding. The Jenkins xstream dependency was updated as part of the changes in Jenkins 2.277.1. Updates to match the latest version of xstream are now monitored by dependabot and regularly updated when new xstream releases are delivered. Refer to https://www.jenkins.io/changelog-stable/#v2.277.1 and the blog post https://www.jenkins.io/blog/2020/11/10/spring-xstream/ for more details.

          Mark Waite added a comment - Thanks for the feedback chriskilding . The Jenkins xstream dependency was updated as part of the changes in Jenkins 2.277.1. Updates to match the latest version of xstream are now monitored by dependabot and regularly updated when new xstream releases are delivered. Refer to https://www.jenkins.io/changelog-stable/#v2.277.1 and the blog post https://www.jenkins.io/blog/2020/11/10/spring-xstream/ for more details.

          Chris Kilding added a comment -

          I tried updating the Jenkins and BOM version in that plugin to 2.277.1 as you said, and that got the InjectedTest working again in the presence of JDK 11.

          Thanks 

           

          Chris Kilding added a comment - I tried updating the Jenkins and BOM version in that plugin to 2.277.1 as you said, and that got the InjectedTest working again in the presence of JDK 11. Thanks   

          Mark Waite added a comment -

          That's a very interesting observation! The failure you were seeing was running an automated test, not when running Jenkins interactively, right?

          I would expect the issue to be resolved when running a newer Jenkins version (2.277.1, etc.), but it would be visible in plugin automated tests if the required Jenkins version were older than 2.277.1.

          Mark Waite added a comment - That's a very interesting observation! The failure you were seeing was running an automated test, not when running Jenkins interactively, right? I would expect the issue to be resolved when running a newer Jenkins version (2.277.1, etc.), but it would be visible in plugin automated tests if the required Jenkins version were older than 2.277.1.

          Chris Kilding added a comment -

          Yes, it was the automated InjectedTest that failed.

          Chris Kilding added a comment - Yes, it was the automated InjectedTest that failed.

          Mark Waite added a comment -

          Resolved as far as I can tell by the unfork and updates of xstream

          Mark Waite added a comment - Resolved as far as I can tell by the unfork and updates of xstream

            Unassigned Unassigned
            markewaite Mark Waite
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: