Re: RFR: JDK-8242888: Convert dynamic proxy to hidden classes

2022-04-19 Thread Johannes Kuhn
On Sun, 17 Apr 2022 16:17:30 GMT, liach wrote: > Convert dynamic proxies to hidden classes. Modifies the serialization of > proxies (requires change in "Java Object Serialization Specification"). Makes > the proxies hidden in stack traces. Removes duplicate logic in proxy building. > > The mai

Re: RFR: 8283237: CallSite should be a sealed class

2022-03-16 Thread Johannes Kuhn
On Wed, 16 Mar 2022 13:09:30 GMT, liach wrote: > Change `CallSite` to a sealed class, as `CallSite` is an abstract class which > does not allow direct subclassing by users per its documentation. Since I > don't have a JBS account, I posted the content for the CSR in a GitHub Gist > at https://

Re: RFR: 8280377: MethodHandleProxies does not correctly invoke default methods with varags [v4]

2022-01-25 Thread Johannes Kuhn
On Tue, 25 Jan 2022 21:35:27 GMT, Mandy Chung wrote: >> The MethodHandle of a default method should be made as a fixed arity method >> handle because it is invoked via Proxy's invocation handle with a non-vararg >> array of arguments. On the other hand, the >> `InvocationHandle::invokeDefault

Re: RFR: 8280377: MethodHandleProxies does not correctly invoke default methods with varags [v2]

2022-01-24 Thread Johannes Kuhn
On Mon, 24 Jan 2022 23:03:49 GMT, Mandy Chung wrote: >> The MethodHandle of a default method should be made as a fixed arity method >> handle because it is invoked via Proxy's invocation handle with a non-vararg >> array of arguments. On the other hand, the >> `InvocationHandle::invokeDefault

Re: RFR: 8280377: MethodHandleProxies does not correctly invoke default methods with varags

2022-01-22 Thread Johannes Kuhn
On Fri, 21 Jan 2022 22:49:38 GMT, Mandy Chung wrote: > The MethodHandle of a default method should be made as a fixed arity method > handle because it is invoked via Proxy's invocation handle with a non-vararg > array of arguments. On the other hand, the `InvocationHandle::invokeDefault` > me

Re: Looking for a starter task. Maybe JDK-8253396 (Please add `not()` method to `java.util.function.BiPredicate`)?

2021-03-23 Thread Johannes Kuhn
Hi and welcome. I would not consider JDK-8253396 (Please add `not()` method to `java.util.function.BiPredicate`) a good starter bug. Generally, any bug that tries to add new APIs are hard, and require a lot of time and effort. While the implementation of java.util.function.BiPredicate.not()

Re: RFR: 8263508: Remove dead code in MethodHandleImpl

2021-03-12 Thread Johannes Kuhn
On Fri, 12 Mar 2021 13:27:39 GMT, Claes Redestad wrote: > Remove unused methods. LGTM - Marked as reviewed by jkuhn (Author). PR: https://git.openjdk.java.net/jdk/pull/2969

Re: JDK-8262003: Class.arrayType should not throw IllegalArgumentException

2021-02-25 Thread Johannes Kuhn
html#jvms-4.9.1 On 2/23/21 6:38 AM, Johannes Kuhn wrote: I want to learn about writing a CSR, and need a sponsor teaching me the ropes. Bug: https://bugs.openjdk.java.net/browse/JDK-8262003 Currently, Class.arrayType() will throw an IllegalArgumentException if the maximum number of dim

JDK-8262003: Class.arrayType should not throw IllegalArgumentException

2021-02-23 Thread Johannes Kuhn
I want to learn about writing a CSR, and need a sponsor teaching me the ropes. Bug: https://bugs.openjdk.java.net/browse/JDK-8262003 Currently, Class.arrayType() will throw an IllegalArgumentException if the maximum number of dimensions will be exceeded. Throwing an IllegalArgumentExce

Re: JDK-6824466 java.lang.reflect.Method should use java.lang.invoke.MethodHandle

2021-02-08 Thread Johannes Kuhn
I now implemented a prototype for JDK-6824466: [1] The goal I set here was to remove the old AccessorGenerator. The good news: - It works - all tier1 tests pass, except one that requires the old implementation. - A lot of code has been removed. And even more could be removed. The bad news:

Re: RFR: 8261254: Initialize charset mapping data lazily

2021-02-08 Thread Johannes Kuhn
On Sun, 7 Feb 2021 19:08:18 GMT, Claes Redestad wrote: > This patch refactor JDK internal charsets to initialize charset mapping data > lazily when needed via holder classes. This means both a startup improvement > in some cases, and possible throughput improvements for all DoubleByte-based >

Re: RFR: 8013527: calling MethodHandles.lookup on itself leads to errors [v2]

2021-02-03 Thread Johannes Kuhn
On Wed, 3 Feb 2021 18:40:15 GMT, Mandy Chung wrote: >> JDK-8013527: calling MethodHandles.lookup on itself leads to errors >> JDK-8257874: MethodHandle injected invoker doesn't have necessary private >> access >> >> Johannes Kuhn is also a contributor to th

Re: RFR: 8013527: calling MethodHandles.lookup on itself leads to errors [v2]

2021-02-03 Thread Johannes Kuhn
On Wed, 3 Feb 2021 18:34:55 GMT, Mandy Chung wrote: >> You are right, got it confused with the future use. >> >> With this fix, MethodHandle -> Method.invoke -> MethodHandles.lookup() will >> still return a lookup on the injected invoker. >> I somehow missed that this is not part of the fix,

Re: RFR: 8013527: calling MethodHandles.lookup on itself leads to errors

2021-02-03 Thread Johannes Kuhn
On Wed, 3 Feb 2021 17:25:04 GMT, Mandy Chung wrote: >> Only `Lookup` with the original access can access `MethodHandles.classData`. >> A hidden class `HC$$InjectedInvoker/0x1234` can access private members of >> another class `C` in the same nest but not `C`'s class data. >> >> I don't follo

Re: RFR: 8013527: calling MethodHandles.lookup on itself leads to errors

2021-02-03 Thread Johannes Kuhn
On Wed, 3 Feb 2021 01:50:36 GMT, Mandy Chung wrote: > JDK-8013527: calling MethodHandles.lookup on itself leads to errors > JDK-8257874: MethodHandle injected invoker doesn't have necessary private > access > > Johannes Kuhn is also a contributor to this patch. > >

Re: JDK-6824466 java.lang.reflect.Method should use java.lang.invoke.MethodHandle

2021-02-02 Thread Johannes Kuhn
https://mail.openjdk.java.net/pipermail/core-libs-dev/2021-January/073184.html On 02-Feb-21 11:07, Alan Bateman wrote: On 01/02/2021 15:19, Johannes Kuhn wrote: : Thanks Rémi. The problem here is that (according to Peter Levart tests), the cold use of a MHMethodAccessor is 11x as expensiv

Re: JDK-6824466 java.lang.reflect.Method should use java.lang.invoke.MethodHandle

2021-02-01 Thread Johannes Kuhn
on method handles.   This would greatly simplify the work to add support for a new feature for example Valhalla primitive classes only in method handles.   I plan to keep the native method accessor  for startup use (or switch to method handles when module system is initialized). Ma

Re: JDK-6824466 java.lang.reflect.Method should use java.lang.invoke.MethodHandle

2021-02-01 Thread Johannes Kuhn
On 01-Feb-21 15:58, Remi Forax wrote: - Mail original - De: "Johannes Kuhn" À: "core-libs-dev" Envoyé: Lundi 1 Février 2021 15:50:51 Objet: JDK-6824466 java.lang.reflect.Method should use java.lang.invoke.MethodHandle While implementing a prototype for

JDK-6824466 java.lang.reflect.Method should use java.lang.invoke.MethodHandle

2021-02-01 Thread Johannes Kuhn
While implementing a prototype for JDK-8242888 (Convert dynamic proxy to hidden classes) I came across the problem that hidden classes can't be mentioned in the constant pool, breaking the constructor for serialization. To remedy that problem, I used a MHConstructorAccessor which delegates the

Integrated: JDK-8259395 Patching automatic module with additional packages re-creates module without "requires java.base"

2021-02-01 Thread Johannes Kuhn
On Fri, 8 Jan 2021 09:38:40 GMT, Johannes Kuhn wrote: > Simple fix - one line change: > https://openjdk.github.io/cr/?repo=jdk&pr=2000&range=00#sdiff-0. > > Most of the changes come from an additional test that fails without this fix: > > Error:

Re: RFR: JDK-8259395 Patching automatic module with additional packages re-creates module without "requires java.base" [v6]

2021-01-31 Thread Johannes Kuhn
59395. > You can view the output of the test without patch here: > https://github.com/DasBrain/jdk/runs/1668078245 > > Thanks to @AlanBateman for pointing out the right fix. Johannes Kuhn has updated the pull request incrementally with one additional commit since the last revision: Re

Integrated: 8259922 MethodHandles.collectArguments does not throw IAE if pos is outside the arity range

2021-01-22 Thread Johannes Kuhn
On Wed, 20 Jan 2021 18:29:00 GMT, Johannes Kuhn wrote: > Add explicit range check to `MethodHandles.collectArgumentsCheck`. > Added test case that exercises all cases. > > This is a behavioral change, from throwing an unspecified exception to > throwing an IllegalArgume

Re: RFR: 8259922 MethodHandles.collectArguments does not throw IAE if pos is outside the arity range [v2]

2021-01-21 Thread Johannes Kuhn
On Fri, 22 Jan 2021 00:48:51 GMT, Johannes Kuhn wrote: >> Looks good. What tests have you ran? > > On the latest commit, only my own test. > On the previous commit (4f74e2d) I did run the full tier1. > > Currently a full test tier1 run on my machine and github acti

Re: RFR: 8259922 MethodHandles.collectArguments does not follow its documentation [v2]

2021-01-21 Thread Johannes Kuhn
On Fri, 22 Jan 2021 00:44:12 GMT, Mandy Chung wrote: >> Johannes Kuhn has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Implement suggestions by Mandy Chung. > > Looks good. What tests have you ran? On

Re: RFR: 8259922 MethodHandles.collectArguments does not follow its documentation [v2]

2021-01-21 Thread Johannes Kuhn
nge needed, as the IllegalArgumentException is already specified > to be thrown in those cases. > > Feel free to suggest a better place for the tests. Johannes Kuhn has updated the pull request incrementally with one additional commit since the last revision: Implement suggestions by Mandy Chung.

Re: RFR: 8259922 MethodHandles.collectArguments does not follow its documentation

2021-01-21 Thread Johannes Kuhn
On Thu, 21 Jan 2021 22:54:56 GMT, Mandy Chung wrote: >> Add explicit range check to `MethodHandles.collectArgumentsCheck`. >> Added test case that exercises all cases. >> >> This is a behavioral change, from throwing an unspecified exception to >> throwing an IllegalArgumentException, as spec

RFR: 8259922 MethodHandles.collectArguments does not follow its documentation

2021-01-20 Thread Johannes Kuhn
Add explicit range check to `MethodHandles.collectArgumentsCheck`. Added test case that exercises all cases. This is a behavioral change, from throwing an unspecified exception to throwing an IllegalArgumentException, as specified. No spec change needed, as the IllegalArgumentException is alr

Re: RFR: JDK-8259395 Patching automatic module with additional packages re-creates module without "requires java.base" [v5]

2021-01-19 Thread Johannes Kuhn
59395. > You can view the output of the test without patch here: > https://github.com/DasBrain/jdk/runs/1668078245 > > Thanks to @AlanBateman for pointing out the right fix. Johannes Kuhn has updated the pull request incrementally with one additional commit since the last revision:

Re: RFR: JDK-8259395 Patching automatic module with additional packages re-creates module without "requires java.base" [v4]

2021-01-19 Thread Johannes Kuhn
59395. > You can view the output of the test without patch here: > https://github.com/DasBrain/jdk/runs/1668078245 > > Thanks to @AlanBateman for pointing out the right fix. Johannes Kuhn has updated the pull request incrementally with one additional commit since the last revision:

Re: RFR: JDK-8259395 Patching automatic module with additional packages re-creates module without "requires java.base" [v3]

2021-01-19 Thread Johannes Kuhn
On Tue, 19 Jan 2021 16:14:51 GMT, Alan Bateman wrote: >>> >>> >>> This issue requires a Reviewer from someone working in this area. Please do >>> not sponsor or integrate until that review has been done. >> >> Ok, increased the number of required reviewers to 2. >> Hope that was the right m

Re: A Bug involving MethodHandles, Nestmates, Reflection and @CallerSensitive

2021-01-18 Thread Johannes Kuhn
uried in https://github.com/openjdk/jdk/compare/master...mlchung:method-invoke. I will extract that fix and post a PR on my proposed fix. Mandy On 1/16/21 10:07 AM, Johannes Kuhn wrote: After digging though the JBS, I found this comment from John Rose[1]. I like the general idea, but I don't thin

Trying to fix JDK-8013527 - 1st Prototype

2021-01-17 Thread Johannes Kuhn
JDK-8013527[1] has somehow become the umbrella bug for "Using MethodHandles to call caller sensitive methods leads to interesting results". To recap: A caller sensitive method knows about who called it, and can behave differently when called from an other context. Examples are: Class.forName,

Re: A Bug involving MethodHandles, Nestmates, Reflection and @CallerSensitive

2021-01-16 Thread Johannes Kuhn
nt-tabpanel#comment-13611844 On 09-Dec-20 21:09, Johannes Kuhn wrote: On 09-Dec-20 19:44, Mandy Chung wrote: On 12/8/20 6:02 PM, Johannes Kuhn wrote: There are a lot of things to consider when trying to fix JDK-8013527. Exactly in particular security implication!  What is clear is that t

Re: RFR: JDK-8259395 Patching automatic module with additional packages re-creates module without "requires java.base" [v3]

2021-01-11 Thread Johannes Kuhn
On Mon, 11 Jan 2021 14:13:47 GMT, Alan Bateman wrote: > > > This issue requires a Reviewer from someone working in this area. Please do > not sponsor or integrate until that review has been done. Ok, increased the number of required reviewers to 2. Hope that was the right move, as I don't s

Re: RFR: JDK-8259395 Patching automatic module with additional packages re-creates module without "requires java.base" [v3]

2021-01-11 Thread Johannes Kuhn
On Mon, 11 Jan 2021 14:06:12 GMT, Attila Szegedi wrote: >> Johannes Kuhn has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Add a missing pesky newline. > > Marked as reviewed by attila (Reviewer). Than

Re: RFR: JDK-8259395 Patching automatic module with additional packages re-creates module without "requires java.base" [v3]

2021-01-10 Thread Johannes Kuhn
59395. > You can view the output of the test without patch here: > https://github.com/DasBrain/jdk/runs/1668078245 > > Thanks to @AlanBateman for pointing out the right fix. Johannes Kuhn has updated the pull request incrementally with one additional commit since the last revision:

Re: RFR: JDK-8259395 Patching automatic module with additional packages re-creates module without "requires java.base" [v2]

2021-01-10 Thread Johannes Kuhn
59395. > You can view the output of the test without patch here: > https://github.com/DasBrain/jdk/runs/1668078245 > > Thanks to @AlanBateman for pointing out the right fix. Johannes Kuhn has updated the pull request incrementally with one additional commit since the last revision

Re: RFR: JDK-8259395 Patching automatic module with additional packages re-creates module without "requires java.base"

2021-01-10 Thread Johannes Kuhn
On Sun, 10 Jan 2021 15:14:31 GMT, Alan Bateman wrote: >> Simple fix - one line change: >> https://openjdk.github.io/cr/?repo=jdk&pr=2000&range=00#sdiff-0. >> >> Most of the changes come from an additional test that fails without this fix: >> >> Error: Unable to load main class somelib.tes

RFR: JDK-8259395 Patching automatic module with additional packages re-creates module without "requires java.base"

2021-01-08 Thread Johannes Kuhn
Simple fix, complex test case. Thanks to @AlanBateman for pointing out the right fix. - Commit messages: - * Minor cleanup. - * Fix Whitespace V2 - * Fix whitespace - * Fix JDK-8259395 - test now passes - Merge branch 'master' of https://github.com/openjdk/jdk into JDK-8259395

Re: java.io.Console (was: Is SharedSecrets thread-safe?)

2021-01-04 Thread Johannes Kuhn
This brings up some stuff I wanted to mention for some time: * Console.cs is one of the fields projects like JRuby hack into (at least in the past). My guess is that they handle encodings in Ruby, and not using the Java facilities for that. The fact that it is also exported as shared secret f

Re: RFR: 8198540: Dynalink leaks memory when generating type converters

2021-01-02 Thread Johannes Kuhn
On Sat, 2 Jan 2021 14:45:51 GMT, Attila Szegedi wrote: > _(NB: For this leak to occur, an application needs to be either creating and > discarding linkers frequently, or creating and discarding class loaders > frequently while creating Dynalink type converters for classes in them. > Neither is

Re: RFR: 8198540: Dynalink leaks memory when generating type converters

2021-01-02 Thread Johannes Kuhn
On Sat, 2 Jan 2021 14:45:51 GMT, Attila Szegedi wrote: > _(NB: For this leak to occur, an application needs to be either creating and > discarding linkers frequently, or creating and discarding class loaders > frequently while creating Dynalink type converters for classes in them. > Neither is

Re: Is SharedSecrets thread-safe?

2020-12-29 Thread Johannes Kuhn
shared secrets don't have fields. The better news: reference assignment also can't be teared. - Johannes [1]: https://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html On 29-Dec-20 18:53, Hans Boehm wrote: On Tue, Dec 29, 2020 at 5:56 AM Johannes Kuhn <mailto:i..

Re: Is SharedSecrets thread-safe?

2020-12-29 Thread Johannes Kuhn
Depends on what `initialize()` is. If it (at least) reads a volatile field, then the compiler can't reorder the second read before the first. - Johannes On 29-Dec-20 14:42, some-java-user-99206970363698485...@vodafonemail.de wrote: Hello, the class `jdk.internal.access.SharedSecrets` provid

Re: JDK-8229959/JDK-8242888 Prototype for j.l.r.Proxy with hidden classes & class data

2020-12-17 Thread Johannes Kuhn
tps://github.com/openjdk/jdk/pull/960 On 12/17/20 2:07 PM, Johannes Kuhn wrote: Now that class data support for hidden classes in master, I decided to tackle JDK-8229959 again. JDK-8229959: Convert proxy class to use constant dynamic [1] JDK-8242888: Convert dynamic proxy to hidden classes [2

JDK-8229959/JDK-8242888 Prototype for j.l.r.Proxy with hidden classes & class data

2020-12-17 Thread Johannes Kuhn
Now that class data support for hidden classes in master, I decided to tackle JDK-8229959 again. JDK-8229959: Convert proxy class to use constant dynamic [1] JDK-8242888: Convert dynamic proxy to hidden classes [2] The idea is simple: Define proxies as hidden classes, pass the methods as class

Re: A Bug involving MethodHandles, Nestmates, Reflection and @CallerSensitive

2020-12-09 Thread Johannes Kuhn
On 09-Dec-20 19:44, Mandy Chung wrote: On 12/8/20 6:02 PM, Johannes Kuhn wrote: There are a lot of things to consider when trying to fix JDK-8013527. Exactly in particular security implication!  What is clear is that the expected lookup class should not be the injected class.   The key

Re: A Bug involving MethodHandles, Nestmates, Reflection and @CallerSensitive

2020-12-08 Thread Johannes Kuhn
On 09-Dec-20 1:16, Mandy Chung wrote: On 12/8/20 5:07 AM, Johannes Kuhn wrote: Not sure if I read this correctly as "please share some example of code that tries to do that" or "please share code that you write to fix that". So I do both. I was curious to find o

Re: A Bug involving MethodHandles, Nestmates, Reflection and @CallerSensitive

2020-12-08 Thread Johannes Kuhn
On 08-Dec-20 5:40, Mandy Chung wrote: Thanks David.  I was about to create one. This is indeed a gap in injecting this trampoline class for supporting @CallerSensitive methods.  The InjectedInvoker ensures that the InjectedInvoker class has the same class loader as the lookup class.  W.r.t. y

A Bug involving MethodHandles, Nestmates, Reflection and @CallerSensitive

2020-12-07 Thread Johannes Kuhn
Let's start with the reproducer:     public class NestmateBug {     private static int field = 0;     public static void main(String[] args) throws Throwable {     Lookup l = MethodHandles.lookup();     Field f = NestmateBug.class.getDeclaredField("field");     Met

Can sun.misc.Unsafe.throwException() be removed?

2020-08-04 Thread Johannes Kuhn
From my understanding, Unsafe.throwException throws the passed Throwable, more commonly known as "snaky throws". There are other ways to archive the same result, one commonly found is by (ab)using generics:     public static void sneakyThrows(Throwable t) throws T {     throw (T) t;   

Re: RFR: 8247532: Records deserialization is slow

2020-06-14 Thread Johannes Kuhn
On 14-Jun-20 18:28, Peter Levart wrote: Hi, I noticed that deserializing records (new preview Java feature in JDK14 and JDK15) is slow compared to equivalent classical classes. I created a JMH benchmark [1] to se how it compares (ran it on JDK14): Benchmark Mode  Cnt   Score    Err

Re: JPackage with a modular application fails to load record class files even with --enable-preview

2020-06-09 Thread Johannes Kuhn
Relevant StackOverlow question: https://stackoverflow.com/questions/61504956/records-in-jlinked-application-throws-exception It talks about JLink, but the error message is the same, so I expect the same root cause: The ASM version shipped with JDK 14 doesn't support records yet. It is already

JDK-8229959: Current status and thoughts about JDK-8242888

2020-06-03 Thread Johannes Kuhn
Hi, half a year ago, I proposed a patch that implements JDK-8229959: Convert proxy class to use constant dynamic [2]. **Background**: java.lang.reflect.Proxy creates a class file at runtime that extends j.l.r.Proxy and implements the passed interfaces. Methods invoked on that proxy are passed

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-29 Thread Johannes Kuhn
-20 21:23, Mandy Chung wrote: It's fixed.  Thanks Mandy On 5/28/20 4:35 PM, Johannes Kuhn wrote: Hi, just noticed a small thing: The magic is 4 bytes, but readUnsignedShort reads two bytes. - Johannes On 28-May-20 19:25, Mandy Chung wrote: On 5/28/20 6:55 AM, Alan Bateman wrote: On

Re: RFR: JDK-8245432: Lookup::defineHiddenClass should throw UnsupportedClassVersionError if the given bytes are of an unsupported major or minor version

2020-05-28 Thread Johannes Kuhn
Hi, just noticed a small thing: The magic is 4 bytes, but readUnsignedShort reads two bytes. - Johannes On 28-May-20 19:25, Mandy Chung wrote: On 5/28/20 6:55 AM, Alan Bateman wrote: On 28/05/2020 05:13, Mandy Chung wrote: Updated webrev: http://cr.openjdk.java.net/~mchung/jdk15/webrevs/82

Mismatch between spec and implementation of DataInputStream.readFully(byte[], int, int)

2020-05-14 Thread Johannes Kuhn
Found a small mismatch between the specification of DataInputStream.readFully(byte[] b, int off, int len) and its implementation. In particular, it doesn't throw an IndexOutOfBoundsException if offset is negative and len is 0. Reproducer below. I suggest changing the specification of this m

Re: JDK-8226810: An other case and a small change suggestion

2020-05-11 Thread Johannes Kuhn
On 11-May-20 10:59, Alan Bateman wrote: On 10/05/2020 15:47, Johannes Kuhn wrote: : After the discussion with Naoto, I would like to change the one line to strcpy(ret + 2, "1252") diff --git a/src/java.base/windows/native/libjava/java_props_md.c b/src/java.base/windows/nati

Re: JDK-8226810: An other case and a small change suggestion

2020-05-10 Thread Johannes Kuhn
On 09-May-20 1:27, Brent Christian wrote: On 5/7/20 5:50 AM, Alan Bateman wrote: On 07/05/2020 12:37, Johannes Kuhn wrote: : In the end, I don't know what causes the bug, or how I can replicate it. I think I did find a likely suspect. > Good sleuthing. I don't what the condi

Re: JDK-8226810: An other case and a small change suggestion

2020-05-08 Thread Johannes Kuhn
hange the additional line to "strcpy(ret+2, "1252");" as Cp is copied in the following switch. Naoto On 5/7/20 5:50 AM, Alan Bateman wrote: On 07/05/2020 12:37, Johannes Kuhn wrote: : In the end, I don't know what causes the bug, or how I can replicate it. I th

JDK-8226810: An other case and a small change suggestion

2020-05-07 Thread Johannes Kuhn
I just saw a question on StackOverflow [1] which reports to have the same issue as in JDK-8226810 [2] - with the same stack trace. While I could not reproduce the issue, I tried to understand which code path could lead to that outcome. While doing so I did come across getEncodingInternal in ja

Re: Some Classes with a public void close() don't implement AutoCloseable

2020-04-16 Thread Johannes Kuhn
of the close() method should be changed. The same applies for the other XML Stream/Event Reader/Writer. Thanks, Johannes On 16-Apr-20 9:28, Alan Bateman wrote: On 16/04/2020 01:28, Johannes Kuhn wrote: : I did not restrict my enumeration to public and exported types - it was easier not to do that

Re: Some Classes with a public void close() don't implement AutoCloseable

2020-04-15 Thread Johannes Kuhn
DK-7057061 Thanks, -Joe On 4/15/2020 5:28 PM, Johannes Kuhn wrote: After failing to wrap a XMLStreamReader in a try-with-resources after discovering it's close() method, I thought about checking what other classes have a public void close() method in the JDK but don't implement

Some Classes with a public void close() don't implement AutoCloseable

2020-04-15 Thread Johannes Kuhn
After failing to wrap a XMLStreamReader in a try-with-resources after discovering it's close() method, I thought about checking what other classes have a public void close() method in the JDK but don't implement AutoCloseable. So I wrote a small program that enumerates all classes present in in

Re: [PATCH] Simplification proposal regarding TYPE-field initialization in primitive wrappers

2019-11-26 Thread Johannes Kuhn
ly, something is going to go wrong :) Anyway, I'll notify about >results when this is done. > >Regards, >Sergey Tsypanov > > >26.11.2019, 21:57, "Johannes Kuhn" : >> On November 26, 2019 8:29:06 PM GMT+01:00, "Сергей Цыпанов" > wrote: >>

Re: New candidate JEP: 370: Foreign-Memory Access API

2019-11-26 Thread Johannes Kuhn
Hi, Just had the chance to look at the proposal, and I have a small suggestion: MemorySegmenent::mapFromPath should state that it can throw a SecurityException if a SecurityManager is installed in the javadoc. The description can be copied from FileChannel::open. With best regards, Johannes

Re: [PATCH] Simplification proposal regarding TYPE-field initialization in primitive wrappers

2019-11-26 Thread Johannes Kuhn
On November 26, 2019 8:29:06 PM GMT+01:00, "Сергей Цыпанов" wrote: >Hello, > >while using java.lang.Integer.TYPE I've found out that currently >wrapper classes for primitives initialize their own TYPE-fields by >calling native method java.lang.Class.getPrimitiveClass(). > >This can be simplifi

Re: Looking for Sponsor: JDK-8229959 Convert proxy class to use constant dynamic

2019-11-23 Thread Johannes Kuhn
On 11/23/2019 10:40 PM, Brian Goetz wrote: Finally, we can benchmark the current approach against the LDC approach on a per-Method basis.  The LDC approach may well be doing more work per Method, so it's a tradeoff to determine whether deferring that work is a win. By this last bit, I mea

Re: Looking for Sponsor: JDK-8229959 Convert proxy class to use constant dynamic

2019-11-23 Thread Johannes Kuhn
On 11/23/2019 6:09 PM, Brian Goetz wrote: Thanks for the examples. A few comments:   - A reasonable place to consider putting the bootstrap is in Proxy itself.  I am not sure that ConstantBootstraps is the right place (or anywhere in JLI for that matter) unless Method is retrofitted to imple

Re: Looking for Sponsor: JDK-8229959 Convert proxy class to use constant dynamic

2019-11-22 Thread Johannes Kuhn
On 22.11.2019 22:41, Remi Forax wrote: i wonder if some codes in the wild rely on that ? I don't think some code does, but you never know. There is perhaps a better way, as part of the branch nestmates of valhalla, Mandy has added a way to transfer a live object to a Class when defining it, w

Re: Looking for Sponsor: JDK-8229959 Convert proxy class to use constant dynamic

2019-11-22 Thread Johannes Kuhn
esh this out with a code example, that shows the proposed old and new translation. This would make it easier for folks to evaluate the benefits and costs of the approach, and possibly suggest improvements. > > On 11/21/2019 10:23 PM, Johannes Kuhn wrote: >> >> * What benefits wou

Re: Looking for Sponsor: JDK-8229959 Convert proxy class to use constant dynamic

2019-11-22 Thread Johannes Kuhn
benefits and costs of the approach, and possibly suggest improvements. On 11/21/2019 10:23 PM, Johannes Kuhn wrote: * What benefits would such a change have? First, it allows us to drop the static final fields and the class initializer for the generated proxy classes. Second, it allows the code (both

Looking for Sponsor: JDK-8229959 Convert proxy class to use constant dynamic

2019-11-21 Thread Johannes Kuhn
ave to be made and where. In that case, I volunteer to write those requests and send them to my sponsor, who can (at their sole discretion) forward it to the relevant places. If you have any additional questions, please don't hesitate to answer to this mail. I will try to answer all questi

Re: RFR JDK-8233527: Update Lookup::hasPrivateAccess and Lookup::defineClass spec w.r.t. full power lookup

2019-11-13 Thread Johannes Kuhn
On 13.11.2019 20:07, Mandy Chung wrote: Thank you for all those changes. It fixed two of my reported bugs (JDK-8209005, JDK-8209078). Thanks for filing these good reports.   JDK-8173978 resolved the issues reported by JDK-8209005 and JDK-8209078. I'm happy I could help. It also makes my sugge

Re: RFR JDK-8233527: Update Lookup::hasPrivateAccess and Lookup::defineClass spec w.r.t. full power lookup

2019-11-13 Thread Johannes Kuhn
On 11.11.2019 22:23, Mandy Chung wrote: This is a follow-up of JDK-8226916. Lookup::hasPrivateAccess intends to test if this lookup is a full-power lookup; that is created by the original caller class calling MethodHandles::lookup. The current specification for Lookup::hasPrivateAccess returns

Re: [JDK-8209078] Unable to call default interface methods from named module

2018-09-17 Thread Johannes Kuhn
Hi, thanks for your quick reply. On 16/09/2018 11:15, Alan Bateman wrote: > On 14/09/2018 20:34, Johannes Kuhn wrote: >> : >> >> 1. Use Case: >> >> The most obvious use case is to to "implement" default methods in >> insta

[JDK-8209078] Unable to call default interface methods from named module

2018-09-15 Thread Johannes Kuhn
y to express that. Instead don't allow any lookup on members in a different module if the MODULE flag is not set. But this is only a suggestion. It's up to you to decide how to deal with this. Please keep up the good work you are doing, and I hope this mail will help you fixi