JDK-8216261 : Javap ignores default modifier on interfaces
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javap
  • Affected Version: 8,11.0.1,12
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86_64
  • Submitted: 2018-12-27
  • Updated: 2019-12-02
  • Resolved: 2019-06-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 14
11.0.5Fixed 13 b25Fixed 14Fixed
Related Reports
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
linux 64 bit 

A DESCRIPTION OF THE PROBLEM :
Interfaces can have default implementation. javap -p ignores this modifier while dumping out interfaces.

Example:

javap -p "java.util.Comparator"
Compiled from "Comparator.java"
public interface java.util.Comparator<T> {
  public abstract int compare(T, T);
  public abstract boolean equals(java.lang.Object);
  public java.util.Comparator<T> reversed();
  public java.util.Comparator<T> thenComparing(java.util.Comparator<? super T>);
  public <U> java.util.Comparator<T> thenComparing(java.util.function.Function<? super T, ? extends U>, java.util.Comparator<? super U>);
  public <U extends java.lang.Comparable<? super U>> java.util.Comparator<T> thenComparing(java.util.function.Function<? super T, ? extends U>);
  public java.util.Comparator<T> thenComparingInt(java.util.function.ToIntFunction<? super T>);
  public java.util.Comparator<T> thenComparingLong(java.util.function.ToLongFunction<? super T>);
  public java.util.Comparator<T> thenComparingDouble(java.util.function.ToDoubleFunction<? super T>);
  public static <T extends java.lang.Comparable<? super T>> java.util.Comparator<T> reverseOrder();
  public static <T extends java.lang.Comparable<? super T>> java.util.Comparator<T> naturalOrder();
  public static <T> java.util.Comparator<T> nullsFirst(java.util.Comparator<? super T>);
  public static <T> java.util.Comparator<T> nullsLast(java.util.Comparator<? super T>);
  public static <T, U> java.util.Comparator<T> comparing(java.util.function.Function<? super T, ? extends U>, java.util.Comparator<? super U>);
  public static <T, U extends java.lang.Comparable<? super U>> java.util.Comparator<T> comparing(java.util.function.Function<? super T, ? extends U>);
  public static <T> java.util.Comparator<T> comparingInt(java.util.function.ToIntFunction<? super T>);
  public static <T> java.util.Comparator<T> comparingLong(java.util.function.ToLongFunction<? super T>);
  public static <T> java.util.Comparator<T> comparingDouble(java.util.function.ToDoubleFunction<? super T>);
  private static java.lang.Object $deserializeLambda$(java.lang.invoke.SerializedLambda);
  private static int lambda$comparingDouble$8dcf42ea$1(java.util.function.ToDoubleFunction, java.lang.Object, java.lang.Object);
  private static int lambda$comparingLong$6043328a$1(java.util.function.ToLongFunction, java.lang.Object, java.lang.Object);
  private static int lambda$comparingInt$7b0bb60$1(java.util.function.ToIntFunction, java.lang.Object, java.lang.Object);
  private static int lambda$comparing$77a9974f$1(java.util.function.Function, java.lang.Object, java.lang.Object);
  private static int lambda$comparing$ea9a8b3a$1(java.util.Comparator, java.util.function.Function, java.lang.Object, java.lang.Object);
  private int lambda$thenComparing$36697e65$1(java.util.Comparator, java.lang.Object, java.lang.Object);
}




Comments
Fix Request (11u) Backporting this patch improves diagnostics. Patch applies cleanly to 11u, new test fails without product fix, passes with it. tier1, tier2 tests pass with the patch. Requires JDK-8225386 as the follow-up.
26-08-2019

When javap tool is used to print all classes and members of any class/interface, 'default' modifier is not printed for default methods. For e.g. 'reversed' method has default implementation in "java.util.Comparator" interface, but javap prints "public java.util.Comparator<T> reversed();" javap -p "java.util.Comparator" Compiled from "Comparator.java" public interface java.util.Comparator<T> { public abstract int compare(T, T); public abstract boolean equals(java.lang.Object); public java.util.Comparator<T> reversed(); public java.util.Comparator<T> thenComparing(java.util.Comparator<? super T>); public <U> java.util.Comparator<T> thenComparing(java.util.function.Function<? super T, ? extends U>, java.util.Comparator<? super U>); public <U extends java.lang.Comparable<? super U>> java.util.Comparator<T> thenComparing(java.util.function.Function<? super T, ? extends U>); public java.util.Comparator<T> thenComparingInt(java.util.function.ToIntFunction<? super T>); public java.util.Comparator<T> thenComparingLong(java.util.function.ToLongFunction<? super T>); public java.util.Comparator<T> thenComparingDouble(java.util.function.ToDoubleFunction<? super T>); public static <T extends java.lang.Comparable<? super T>> java.util.Comparator<T> reverseOrder(); public static <T extends java.lang.Comparable<? super T>> java.util.Comparator<T> naturalOrder(); public static <T> java.util.Comparator<T> nullsFirst(java.util.Comparator<? super T>); public static <T> java.util.Comparator<T> nullsLast(java.util.Comparator<? super T>); public static <T, U> java.util.Comparator<T> comparing(java.util.function.Function<? super T, ? extends U>, java.util.Comparator<? super U>); public static <T, U extends java.lang.Comparable<? super U>> java.util.Comparator<T> comparing(java.util.function.Function<? super T, ? extends U>); public static <T> java.util.Comparator<T> comparingInt(java.util.function.ToIntFunction<? super T>); public static <T> java.util.Comparator<T> comparingLong(java.util.function.ToLongFunction<? super T>); public static <T> java.util.Comparator<T> comparingDouble(java.util.function.ToDoubleFunction<? super T>); private static java.lang.Object $deserializeLambda$(java.lang.invoke.SerializedLambda); private static int lambda$comparingDouble$8dcf42ea$1(java.util.function.ToDoubleFunction, java.lang.Object, java.lang.Object); private static int lambda$comparingLong$6043328a$1(java.util.function.ToLongFunction, java.lang.Object, java.lang.Object); private static int lambda$comparingInt$7b0bb60$1(java.util.function.ToIntFunction, java.lang.Object, java.lang.Object); private static int lambda$comparing$77a9974f$1(java.util.function.Function, java.lang.Object, java.lang.Object); private static int lambda$comparing$ea9a8b3a$1(java.util.Comparator, java.util.function.Function, java.lang.Object, java.lang.Object); private int lambda$thenComparing$36697e65$1(java.util.Comparator, java.lang.Object, java.lang.Object); } Submitter has requested an enhancement to print 'default' modifier for default implementations.
07-01-2019