Re: JEP 416: Missing throws IllegalArgumentException declaration for Method::invoke?

2021-11-11 Thread Marc Hoffmann
Dear Alan,

no issue at all, I just noticed in the API diff and wanted to understand 
whether this was on purpose. Also 

Thanks for the background information!
-marc

> On 11. Nov 2021, at 09:48, Alan Bateman  wrote:
> 
> On 11/11/2021 08:21, Marc Hoffmann wrote:
>> Hi,
>> 
>> with the implementation of JEP 416 
>> (https://github.com/openjdk/jdk/commit/c6339cb8a255d387bb182ad20dd69f3d460cf1ed
>>  
>> <https://github.com/openjdk/jdk/commit/c6339cb8a255d387bb182ad20dd69f3d460cf1ed>)
>>  the throws declaration for IllegalArgumentException on Method::invoke was 
>> removed — while it is still described in JavaDoc. Was this on purpose?
>> 
>> Sorry if this was discussed before, but I was not able to find a review 
>> discussion around this commit. Also I’m not sure what the policy is whether 
>> unchecked exceptions should be declared if mentioned in JavaDoc.
> 
> Usually the method throws clause just lists the checked exceptions but there 
> cases where the source code (esp. older code) does declare that it throws 
> IllegalArgumentException, SecurityException or other unchecked exceptions. 
> All exceptions should of course be @throws documented in the method 
> description. In this case, I think it's just cleanup, the method continues to 
> document that it may throw IllegalArgumentException.
> 
> Are you running into an issue or is this just showing up with API diffs?  
> There shouldn't be a compatibility issue but maybe there is something looking 
> at the method Exceptions table that expects to see unchecked exceptions?
> 
> -Alan
> 
> 
> 



JEP 416: Missing throws IllegalArgumentException declaration for Method::invoke?

2021-11-11 Thread Marc Hoffmann
Hi,

with the implementation of JEP 416 
(https://github.com/openjdk/jdk/commit/c6339cb8a255d387bb182ad20dd69f3d460cf1ed 
)
 the throws declaration for IllegalArgumentException on Method::invoke was 
removed — while it is still described in JavaDoc. Was this on purpose?

Sorry if this was discussed before, but I was not able to find a review 
discussion around this commit. Also I’m not sure what the policy is whether 
unchecked exceptions should be declared if mentioned in JavaDoc.

Best regards,
-marc

Accidentally public inner classes in JDK APIs?

2020-12-22 Thread Marc Hoffmann
Dear core libs developers,

I recently noted that the JDK lib implementation comes with a list of public 
inner classes nested in package private classes. Either these classes are 
explicitly flagged as public or they become implicitly public when they are 
nested in interfaces (in accordance to JLS). Full list for JDK 11 see below.

These classes cannot be referenced in source files as the parent types cannot 
be resolved. But access e.g. via reflection is possible:


Class clazz = Class.forName("java.lang.WeakPairMap$Pair$Lookup");
System.out.println(Modifier.isPublic(clazz.getModifiers()));

Question: Are there any guidelines regarding visibility of such inner classes? 
I think in many cases the visibility could be reduced. Is that something that 
is worth a bug or patch?

Regards,
-marc



Public inner classes nested in non-public classes in JDK11:

java/awt/EventFilter$FilterAction
java/lang/FdLibm$Cbrt
java/lang/FdLibm$Hypot
java/lang/FdLibm$Pow
java/lang/LiveStackFrame$PrimitiveSlot
java/lang/WeakPairMap$Pair$Lookup
java/lang/WeakPairMap$Pair$Weak
java/lang/invoke/ClassSpecializer$Factory
java/lang/invoke/ClassSpecializer$SpeciesData
java/util/stream/Node$Builder
java/util/stream/Node$OfDouble
java/util/stream/Node$OfInt
java/util/stream/Node$OfLong
java/util/stream/Node$OfPrimitive
java/util/stream/Sink$ChainedDouble
java/util/stream/Sink$ChainedInt
java/util/stream/Sink$ChainedLong
java/util/stream/Sink$ChainedReference
java/util/stream/Sink$OfDouble
java/util/stream/Sink$OfInt
java/util/stream/Sink$OfLong
javax/swing/MultiUIDefaults$MultiUIDefaultsEnumerator$Type
javax/swing/plaf/basic/DragRecognitionSupport$BeforeDrag
javax/swing/plaf/metal/MetalSplitPaneDivider$MetalDividerLayout
javax/swing/plaf/nimbus/Effect$ArrayCache
javax/swing/text/html/AccessibleHTML$HTMLAccessibleContext
javax/swing/text/html/AccessibleHTML$IconElementInfo$IconAccessibleContext
javax/swing/text/html/AccessibleHTML$TableElementInfo$TableAccessibleContext
javax/swing/text/html/AccessibleHTML$TextElementInfo$TextAccessibleContext
javax/swing/text/html/TableView$RowView
javax/xml/catalog/GroupEntry$PreferType
javax/xml/catalog/GroupEntry$ResolveType