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

JDK8 javac compiles public class with protected static inner interface generic

    XMLWordPrintable

Details

    • x86
    • os_x

    Description

      A DESCRIPTION OF THE PROBLEM :
      JDK8 javac compiles a public class (PodcastListFragment) with a generic parameter (PodcastIdentifiedListStateType) extending a one of its own public inner interfaces (PodcastIdentifiedListState) that extends a protected inner interface (State) of the class' superclass (RxListAsyncValueFragment):

      public abstract class PodcastListFragment<
              PodcastListFragmentType extends PodcastListFragment<
                              PodcastListFragmentType,
                              PodcastListFragmentListenerType,
                              PodcastListAttachmentType,
                              PodcastIdentifiedListStateType,
                              PodcastIdentifiedListAsyncStateType,
                              LoadingType,
                              CompleteType,
                              FailedType
                              >,
              PodcastListFragmentListenerType extends PodcastListFragmentListener<
                              PodcastListFragmentType,
                              PodcastListFragmentListenerType,
                              PodcastListAttachmentType,
                              PodcastIdentifiedListStateType,
                              PodcastIdentifiedListAsyncStateType,
                              LoadingType,
                              CompleteType,
                              FailedType
                              >,
              PodcastListAttachmentType extends RxFragment.Attachment<
                      PodcastListFragmentType,
                      PodcastListFragmentListenerType,
                      PodcastListAttachmentType
                      >,
              PodcastIdentifiedListStateType extends PodcastListFragment.PodcastIdentifiedListState<
                      PodcastIdentifiedListAsyncStateType,
                      LoadingType,
                      CompleteType,
                      FailedType
                      >,
              PodcastIdentifiedListAsyncStateType extends PodcastListFragment.PodcastIdentifiedListAsyncState<
                      LoadingType,
                      CompleteType,
                      FailedType
                      >,
              LoadingType extends PodcastListFragment.PodcastIdentifiedListAsyncState.PodcastIdentifiedListAsyncStateLoading<
                      LoadingType,
                      CompleteType,
                      FailedType
                      >,
              CompleteType extends PodcastListFragment.PodcastIdentifiedListAsyncState.PodcastIdentifiedListAsyncStateComplete<
                      LoadingType,
                      CompleteType,
                      FailedType
                      >,
              FailedType extends PodcastListFragment.PodcastIdentifiedListAsyncState.PodcastIdentifiedListAsyncStateFailed<
                      LoadingType,
                      CompleteType,
                      FailedType
                      >
              > extends RxListAsyncValueFragment<
              PodcastListFragmentType,
              PodcastListFragmentListenerType,
              PodcastListAttachmentType
              > { ... }

      public abstract class RxListAsyncValueFragment<
              FragmentType extends RxListAsyncValueFragment<
                      FragmentType,
                      ListenerType,
                      AttachmentType
                      >,
              ListenerType,
              AttachmentType extends RxFragment.Attachment<
                      FragmentType,
                      ListenerType,
                      AttachmentType
                      >
              > extends RxAsyncValueFragment<
              FragmentType,
              ListenerType,
              AttachmentType
              > { ... }

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Build https://github.com/hborders/HeathCast/tree/jdk_8_bug with gradle and JAVA_HOME=JDK8:
      ./gradlew assembleDebug

      Everything builds fine.

      Now build with JAVA_HOME=JDK9

      > Task :app:compileDebugJavaWithJavac FAILED
      /Users/hborders/workspace/HeathCast/app/src/main/java/com/github/hborders/heathcast/fragments/PodcastListFragment.java:43: error: type argument PodcastListFragmentType is not within bounds of type-variable FragmentType
                      PodcastListFragmentType,
                      ^
        where PodcastListFragmentType,PodcastListFragmentListenerType,PodcastListAttachmentType,PodcastIdentifiedListStateType,PodcastIdentifiedListAsyncStateType,LoadingType,CompleteType,FailedType,FragmentType,ListenerType,AttachmentType are type-variables:
          PodcastListFragmentType extends PodcastListFragment<PodcastListFragmentType,PodcastListFragmentListenerType,PodcastListAttachmentType,PodcastIdentifiedListStateType,PodcastIdentifiedListAsyncStateType,LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          PodcastListFragmentListenerType extends PodcastListFragmentListener<PodcastListFragmentType,PodcastListFragmentListenerType,PodcastListAttachmentType,PodcastIdentifiedListStateType,PodcastIdentifiedListAsyncStateType,LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          PodcastListAttachmentType extends Attachment<PodcastListFragmentType,PodcastListFragmentListenerType,PodcastListAttachmentType> declared in class PodcastListFragment
          PodcastIdentifiedListStateType extends PodcastIdentifiedListState<PodcastIdentifiedListAsyncStateType,LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          PodcastIdentifiedListAsyncStateType extends PodcastIdentifiedListAsyncState<LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          LoadingType extends PodcastIdentifiedListAsyncStateLoading<LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          CompleteType extends PodcastIdentifiedListAsyncStateComplete<LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          FailedType extends PodcastIdentifiedListAsyncStateFailed<LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          FragmentType extends RxFragment<FragmentType,ListenerType,AttachmentType> declared in class Attachment
          ListenerType extends Object declared in class Attachment
          AttachmentType extends Attachment<FragmentType,ListenerType,AttachmentType> declared in class Attachment
      /Users/hborders/workspace/HeathCast/app/src/main/java/com/github/hborders/heathcast/fragments/PodcastListFragment.java:427: error: type argument PodcastListFragmentType is not within bounds of type-variable FragmentType
                          PodcastListFragmentType,
                          ^
        where PodcastListFragmentType,PodcastListFragmentListenerType,PodcastListAttachmentType,PodcastIdentifiedListStateType,PodcastIdentifiedListAsyncStateType,LoadingType,CompleteType,FailedType,FragmentType,ListenerType,AttachmentType are type-variables:
          PodcastListFragmentType extends PodcastListFragment<PodcastListFragmentType,PodcastListFragmentListenerType,PodcastListAttachmentType,PodcastIdentifiedListStateType,PodcastIdentifiedListAsyncStateType,LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          PodcastListFragmentListenerType extends PodcastListFragmentListener<PodcastListFragmentType,PodcastListFragmentListenerType,PodcastListAttachmentType,PodcastIdentifiedListStateType,PodcastIdentifiedListAsyncStateType,LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          PodcastListAttachmentType extends Attachment<PodcastListFragmentType,PodcastListFragmentListenerType,PodcastListAttachmentType> declared in class PodcastListFragment
          PodcastIdentifiedListStateType extends PodcastIdentifiedListState<PodcastIdentifiedListAsyncStateType,LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          PodcastIdentifiedListAsyncStateType extends PodcastIdentifiedListAsyncState<LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          LoadingType extends PodcastIdentifiedListAsyncStateLoading<LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          CompleteType extends PodcastIdentifiedListAsyncStateComplete<LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          FailedType extends PodcastIdentifiedListAsyncStateFailed<LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          FragmentType extends RxFragment<FragmentType,ListenerType,AttachmentType> declared in interface AttachmentFactory
          ListenerType extends Object declared in interface AttachmentFactory
          AttachmentType extends Attachment<FragmentType,ListenerType,AttachmentType> declared in interface AttachmentFactory
      /Users/hborders/workspace/HeathCast/app/src/main/java/com/github/hborders/heathcast/fragments/PodcastListFragment.java:432: error: type argument PodcastListFragmentType is not within bounds of type-variable FragmentType
                          PodcastListFragmentType,
                          ^
        where PodcastListFragmentType,PodcastListFragmentListenerType,PodcastListAttachmentType,PodcastIdentifiedListStateType,PodcastIdentifiedListAsyncStateType,LoadingType,CompleteType,FailedType,FragmentType,ListenerType,AttachmentType are type-variables:
          PodcastListFragmentType extends PodcastListFragment<PodcastListFragmentType,PodcastListFragmentListenerType,PodcastListAttachmentType,PodcastIdentifiedListStateType,PodcastIdentifiedListAsyncStateType,LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          PodcastListFragmentListenerType extends PodcastListFragmentListener<PodcastListFragmentType,PodcastListFragmentListenerType,PodcastListAttachmentType,PodcastIdentifiedListStateType,PodcastIdentifiedListAsyncStateType,LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          PodcastListAttachmentType extends Attachment<PodcastListFragmentType,PodcastListFragmentListenerType,PodcastListAttachmentType> declared in class PodcastListFragment
          PodcastIdentifiedListStateType extends PodcastIdentifiedListState<PodcastIdentifiedListAsyncStateType,LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          PodcastIdentifiedListAsyncStateType extends PodcastIdentifiedListAsyncState<LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          LoadingType extends PodcastIdentifiedListAsyncStateLoading<LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          CompleteType extends PodcastIdentifiedListAsyncStateComplete<LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          FailedType extends PodcastIdentifiedListAsyncStateFailed<LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          FragmentType extends RxFragment<FragmentType,ListenerType,AttachmentType> declared in interface OnAttached
          ListenerType extends Object declared in interface OnAttached
          AttachmentType extends Attachment<FragmentType,ListenerType,AttachmentType> declared in interface OnAttached
      /Users/hborders/workspace/HeathCast/app/src/main/java/com/github/hborders/heathcast/fragments/PodcastListFragment.java:437: error: type argument PodcastListFragmentType is not within bounds of type-variable FragmentType
                          PodcastListFragmentType,
                          ^
        where PodcastListFragmentType,PodcastListFragmentListenerType,PodcastListAttachmentType,PodcastIdentifiedListStateType,PodcastIdentifiedListAsyncStateType,LoadingType,CompleteType,FailedType,FragmentType,ListenerType,AttachmentType are type-variables:
          PodcastListFragmentType extends PodcastListFragment<PodcastListFragmentType,PodcastListFragmentListenerType,PodcastListAttachmentType,PodcastIdentifiedListStateType,PodcastIdentifiedListAsyncStateType,LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          PodcastListFragmentListenerType extends PodcastListFragmentListener<PodcastListFragmentType,PodcastListFragmentListenerType,PodcastListAttachmentType,PodcastIdentifiedListStateType,PodcastIdentifiedListAsyncStateType,LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          PodcastListAttachmentType extends Attachment<PodcastListFragmentType,PodcastListFragmentListenerType,PodcastListAttachmentType> declared in class PodcastListFragment
          PodcastIdentifiedListStateType extends PodcastIdentifiedListState<PodcastIdentifiedListAsyncStateType,LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          PodcastIdentifiedListAsyncStateType extends PodcastIdentifiedListAsyncState<LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          LoadingType extends PodcastIdentifiedListAsyncStateLoading<LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          CompleteType extends PodcastIdentifiedListAsyncStateComplete<LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          FailedType extends PodcastIdentifiedListAsyncStateFailed<LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          FragmentType extends RxFragment<FragmentType,ListenerType,AttachmentType> declared in interface WillDetach
          ListenerType extends Object declared in interface WillDetach
          AttachmentType extends Attachment<FragmentType,ListenerType,AttachmentType> declared in interface WillDetach
      /Users/hborders/workspace/HeathCast/app/src/main/java/com/github/hborders/heathcast/fragments/PodcastListFragment.java:442: error: type argument PodcastListFragmentType is not within bounds of type-variable FragmentType
                          PodcastListFragmentType,
                          ^
        where PodcastListFragmentType,PodcastListFragmentListenerType,PodcastListAttachmentType,PodcastIdentifiedListStateType,PodcastIdentifiedListAsyncStateType,LoadingType,CompleteType,FailedType,FragmentType,ListenerType,AttachmentType are type-variables:
          PodcastListFragmentType extends PodcastListFragment<PodcastListFragmentType,PodcastListFragmentListenerType,PodcastListAttachmentType,PodcastIdentifiedListStateType,PodcastIdentifiedListAsyncStateType,LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          PodcastListFragmentListenerType extends PodcastListFragmentListener<PodcastListFragmentType,PodcastListFragmentListenerType,PodcastListAttachmentType,PodcastIdentifiedListStateType,PodcastIdentifiedListAsyncStateType,LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          PodcastListAttachmentType extends Attachment<PodcastListFragmentType,PodcastListFragmentListenerType,PodcastListAttachmentType> declared in class PodcastListFragment
          PodcastIdentifiedListStateType extends PodcastIdentifiedListState<PodcastIdentifiedListAsyncStateType,LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          PodcastIdentifiedListAsyncStateType extends PodcastIdentifiedListAsyncState<LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          LoadingType extends PodcastIdentifiedListAsyncStateLoading<LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          CompleteType extends PodcastIdentifiedListAsyncStateComplete<LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          FailedType extends PodcastIdentifiedListAsyncStateFailed<LoadingType,CompleteType,FailedType> declared in class PodcastListFragment
          FragmentType extends RxFragment<FragmentType,ListenerType,AttachmentType> declared in interface StateObservableProvider
          ListenerType extends Object declared in interface StateObservableProvider
          AttachmentType extends Attachment<FragmentType,ListenerType,AttachmentType> declared in interface StateObservableProvider
      Note: Some input files use unchecked or unsafe operations.
      Note: Recompile with -Xlint:unchecked for details.
      5 errors

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      JDK 8 should emit the same error as JDK 9.
      ACTUAL -
      JDK 8 emits no error, and things run normally.

      ---------- BEGIN SOURCE ----------
      https://github.com/hborders/HeathCast/tree/jdk_8_bug
      ---------- END SOURCE ----------

      FREQUENCY : always


      Attachments

        Activity

          People

            tongwan Andrew Wang
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: