Re: RFR 8135188: RunFinalizationTest.java Exception java.lang.Error: Test failure: Object was not finalized

2015-10-09 Thread Martin Buchholz
On Thu, Oct 8, 2015 at 11:51 PM, Jaroslav Bachorik < jaroslav.bacho...@oracle.com> wrote: > On 8.10.2015 18:56, Martin Buchholz wrote: > >> Hi Jaroslav, >> >> we all keep writing finalization code like this... welcome to the club! >> >>I think it would be better : >> - never use currentTimeMil

Re: RFR 7199353: Allow ConstructorProperties annotation from any package

2015-10-09 Thread Peter Levart
On 10/09/2015 06:54 PM, Alan Bateman wrote: On 09/10/2015 16:36, Peter Levart wrote: : Sorry, but I must be missing something. When you compile a class (not an MXBean as Daniel pointed out, but a data object class) with JDK9, it can't be used on JDK8 because of class file version. Whe

Re: RFR 8135188: RunFinalizationTest.java Exception java.lang.Error: Test failure: Object was not finalized

2015-10-09 Thread Martin Buchholz
Is the code below expected to be running in the thread created by System.runFinalization()? If so, check for that, i.e. that the thread name is as you expect. 61 } else { 62 /* 63 * A 'non-finalizer' thread in this context means that we 64

Re: RFR 8135188: RunFinalizationTest.java Exception java.lang.Error: Test failure: Object was not finalized

2015-10-09 Thread Martin Buchholz
If it ever happens that an object with a non-trivial finalizer is optimized away, that would be a serious JDK bug, so I would remove the constructor code for MyObject (what are you protecting against?). See my sample code in previous msg. WeakReference ref = new WeakReference(new Object() {

Re: RFR 8135188: RunFinalizationTest.java Exception java.lang.Error: Test failure: Object was not finalized

2015-10-09 Thread Martin Buchholz
85 long targetTime = System.nanoTime()+ TIMEOUT; 86 while (System.nanoTime()< targetTime) { This code violates the rules for usage of nanoTime https://docs.oracle.com/javase/8/docs/api/java/lang/System.html#nanoTime--

Re: RFR 8135188: RunFinalizationTest.java Exception java.lang.Error: Test failure: Object was not finalized

2015-10-09 Thread Martin Buchholz
On Thu, Oct 8, 2015 at 11:51 PM, Jaroslav Bachorik < jaroslav.bacho...@oracle.com> wrote: > On 8.10.2015 18:56, Martin Buchholz wrote: > >> >>I think it would be better : >> - never use currentTimeMillis to measure elapsed time; use nanoTime >> instead >> > > Ok. I suppose this would be becaus

Re: RFR 7199353: Allow ConstructorProperties annotation from any package

2015-10-09 Thread Alan Bateman
On 09/10/2015 16:36, Peter Levart wrote: : Sorry, but I must be missing something. When you compile a class (not an MXBean as Daniel pointed out, but a data object class) with JDK9, it can't be used on JDK8 because of class file version. When you compile a class with JDK8, it can't conta

Re: RFR 7199353: Allow ConstructorProperties annotation from any package

2015-10-09 Thread Peter Levart
On 10/09/2015 02:30 PM, Jaroslav Bachorik wrote: To answer my question: "How is one supposed to compile an MXBean that would work in JDK8- and at the same time in JDK9+ without java.desktop in the module graph?" Annotate the constructor with the both the @j.b.CP and the new @CP. In JDK 9 the

Re: RFR 8135188: RunFinalizationTest.java Exception java.lang.Error: Test failure: Object was not finalized

2015-10-09 Thread Daniel D. Daugherty
> http://cr.openjdk.java.net/~jbachorik/8135188/webrev.01 test/serviceability/dcmd/gc/RunFinalizationTest.java L53: OutputAnalyzer out = ProcessTools.executeProcess(testAppPb); L54: out.stderrShouldNotMatch("^" + FinalizationRunner.FAILED + ".*") L55:.std

Re: RFR 7199353: Allow ConstructorProperties annotation from any package

2015-10-09 Thread Daniel Fuchs
On 09/10/15 14:30, Jaroslav Bachorik wrote: Would it be possible for javac to recognise a class is an MXBean and turn-on -parameters for such classes only by default? Too hacky? Definitely :) Hacky as heck :) I agree with Jaroslav. FWIW - The @CP is not used for the MXBean itself, but for th

Re: RFR 7199353: Allow ConstructorProperties annotation from any package

2015-10-09 Thread Jaroslav Bachorik
On 9.10.2015 14:21, Peter Levart wrote: On 10/09/2015 02:07 PM, Jaroslav Bachorik wrote: On 9.10.2015 13:42, Peter Levart wrote: Hi, I don't think it has been mentioned before, but is @ConstructorProperties still necessary in JDK8+ ? Couldn't the j.l.r.Constructor#getParameters() be used ins

Re: RFR 7199353: Allow ConstructorProperties annotation from any package

2015-10-09 Thread Peter Levart
On 10/09/2015 02:07 PM, Jaroslav Bachorik wrote: On 9.10.2015 13:42, Peter Levart wrote: Hi, I don't think it has been mentioned before, but is @ConstructorProperties still necessary in JDK8+ ? Couldn't the j.l.r.Constructor#getParameters() be used instead? This requires the class to be com

Re: RFR 7199353: Allow ConstructorProperties annotation from any package

2015-10-09 Thread Jaroslav Bachorik
On 9.10.2015 13:42, Peter Levart wrote: Hi, I don't think it has been mentioned before, but is @ConstructorProperties still necessary in JDK8+ ? Couldn't the j.l.r.Constructor#getParameters() be used instead? This requires the class to be compiled with '-parameters' switch. How is one suppo

Re: RFR 7199353: Allow ConstructorProperties annotation from any package

2015-10-09 Thread Alan Bateman
On 09/10/2015 12:42, Peter Levart wrote: Hi, I don't think it has been mentioned before, but is @ConstructorProperties still necessary in JDK8+ ? Couldn't the j.l.r.Constructor#getParameters() be used instead? How is one supposed to compile an MXBean that would work in JDK8 and at the same

Re: RFR 7199353: Allow ConstructorProperties annotation from any package

2015-10-09 Thread Peter Levart
Hi, I don't think it has been mentioned before, but is @ConstructorProperties still necessary in JDK8+ ? Couldn't the j.l.r.Constructor#getParameters() be used instead? How is one supposed to compile an MXBean that would work in JDK8 and at the same time in JDK9+ without java.desktop in the

Re: RFR 8135188: RunFinalizationTest.java Exception java.lang.Error: Test failure: Object was not finalized

2015-10-09 Thread Jaroslav Bachorik
On 9.10.2015 08:51, Jaroslav Bachorik wrote: On 8.10.2015 18:56, Martin Buchholz wrote: Hi Jaroslav, we all keep writing finalization code like this... welcome to the club! I think it would be better : - never use currentTimeMillis to measure elapsed time; use nanoTime instead Ok. I suppo