Re: Source code analysis: calls to wrapper class constructors

2020-11-03 Thread John Rose
On Oct 28, 2020, at 1:05 PM, fo...@univ-mlv.fr wrote: > > I've never seen such bytecode shapes but I don't think i've ever seen a > classfile compiled with a version which was less that Java 1.2. …I’ve seen bytecode shapes, such bytecode shapes as would freeze the marrow. It was dark and rainy,

Re: Source code analysis: calls to wrapper class constructors

2020-10-28 Thread forax
> De: "John Rose" > À: "Remi Forax" > Cc: "Valhalla Expert Group Observers" > , "daniel smith" > , "valhalla-spec-experts" > > Envoyé: Mercredi 28 Octobre 2020 20:08:30 > Objet: Re: Source code analysis: calls to wrapp

Re: Source code analysis: calls to wrapper class constructors

2020-10-28 Thread forax
nvoyé: Mercredi 28 Octobre 2020 20:36:59 > Objet: Re: Source code analysis: calls to wrapper class constructors > On Oct 28, 2020, at 2:32 PM, John Rose < [ mailto:john.r.r...@oracle.com | > john.r.r...@oracle.com ] > wrote: >> invokestatic Integer.$pop2$valueOf(Object,int)V &

Re: Source code analysis: calls to wrapper class constructors

2020-10-28 Thread John Rose
On Oct 28, 2020, at 2:32 PM, John Rose wrote: > > invokestatic Integer.$pop2$valueOf(Object,int)V That would be invokestatic Integer.$pop2$valueOf(String,int,String)V And the dummy object could be an Integer (using a condy) if we don’t want to edit the stack maps that might mention the Integer.

Re: Source code analysis: calls to wrapper class constructors

2020-10-28 Thread John Rose
On Oct 28, 2020, at 10:49 AM, Dan Smith wrote: > > You're right that this disrupts verification; I think we can address this > pre-verification by rewriting the StackMapTable, eliminating all references > to 'uninitialized(Offset)' and shrinking the stack by two. Or we can try to keep the veri

Re: Source code analysis: calls to wrapper class constructors

2020-10-28 Thread John Rose
uot;John Rose" >> À: "daniel smith" >> Cc: "valhalla-spec-experts" >> Envoyé: Mercredi 28 Octobre 2020 05:56:29 >> Objet: Re: Source code analysis: calls to wrapper class constructors > >> On Oct 27, 2020, at 12:27 PM, Dan Smith wrote:

Re: Source code analysis: calls to wrapper class constructors

2020-10-28 Thread forax
- Mail original - > De: "daniel smith" > À: "Remi Forax" , "John Rose" > Cc: "valhalla-spec-experts" > Envoyé: Mercredi 28 Octobre 2020 16:49:49 > Objet: Re: Source code analysis: calls to wrapper class constructors >> On O

Re: Source code analysis: calls to wrapper class constructors

2020-10-28 Thread Dan Smith
> On Oct 27, 2020, at 10:56 PM, John Rose wrote: > > One of the reasons it’s not going to be comprehensive > is code like new Integer(complicatedExpr()), in which > the `new` and `invokespecial ` are separated > by (almost) arbitrarily complex bytecode. > On Oct 28, 2020, at 3:25 AM, Remi Forax

Re: Source code analysis: calls to wrapper class constructors

2020-10-28 Thread forax
- Mail original - > De: "daniel smith" > À: "Remi Forax" > Cc: "valhalla-spec-experts" > Envoyé: Mardi 27 Octobre 2020 21:36:21 > Objet: Re: Source code analysis: calls to wrapper class constructors >> On Oct 27, 2020, at 2:00 PM

Re: Source code analysis: calls to wrapper class constructors

2020-10-28 Thread Remi Forax
- Mail original - > De: "John Rose" > À: "daniel smith" > Cc: "valhalla-spec-experts" > Envoyé: Mercredi 28 Octobre 2020 05:56:29 > Objet: Re: Source code analysis: calls to wrapper class constructors > On Oct 27, 2020, at 12:27 PM, Da

Re: Source code analysis: calls to wrapper class constructors

2020-10-27 Thread John Rose
On Oct 27, 2020, at 12:27 PM, Dan Smith wrote: > > This tooling will support common bytecode patterns like 'new Foo; dup; ...; > invokespecial Foo.;', but will not be a comprehensive solution. > (Mimicking the behavior of instance initialization method invocation in full > generality would be

Re: Source code analysis: calls to wrapper class constructors

2020-10-27 Thread John Rose
On Oct 27, 2020, at 1:36 PM, Dan Smith wrote: > > I'm not sure whether there's a mechanism in HotSpot to generate warnings > about deprecated APIs at link/run time. It does seem like it would be a > reasonable feature... +1 There is no such feature at present; maybe something could be built o

Re: Source code analysis: calls to wrapper class constructors

2020-10-27 Thread Dan Smith
> On Oct 27, 2020, at 2:00 PM, Remi Forax wrote: > > Three remarks: > - the compiler can warn because a code is using new Integer(value) or warn > because the compiler will automatically transform all new Integer(value) to > Integer.valueOf() once Valhalla is integrated, > i prefer the second

Re: Source code analysis: calls to wrapper class constructors

2020-10-27 Thread Remi Forax
- Mail original - > De: "daniel smith" > À: "valhalla-spec-experts" > Envoyé: Mardi 27 Octobre 2020 20:27:39 > Objet: Re: Source code analysis: calls to wrapper class constructors >> On Oct 19, 2020, at 6:01 PM, Dan Smith wrote: >> >&

Re: Source code analysis: calls to wrapper class constructors

2020-10-27 Thread Dan Smith
> On Oct 19, 2020, at 6:01 PM, Dan Smith wrote: > > In the context of the Warnings for Value-Based Classes JEP, we're looking for > usages of the deprecated wrapper class constructors ('new Integer(...)', 'new > Double(...)', etc.). When do these get used? How often is this motivated by > want

Re: Source code analysis: calls to wrapper class constructors

2020-10-26 Thread Brian Goetz
Overall, I find this data quite encouraging.  It says that when we finally deprecate something, the warnings get noticed, and a lot of uses are fixed within a few years.  Surely raising DepCon to FOR_REMOVAL will have additional effect. On 10/23/2020 9:20 PM, Dan Smith wrote: One more data-ga

Re: Source code analysis: calls to wrapper class constructors

2020-10-23 Thread Dan Smith
One more data-gathering exercise: I took a closer look at some popular Maven projects to see how they've evolved in their use of wrapper constructors. - junit:junit < 4.12 (<2014): many problems in junit.framework.Assert & org.junit.Assert 4.12-4.13 (2014-2020): a few problems in junit.frame

Re: Source code analysis: calls to wrapper class constructors

2020-10-22 Thread Dan Smith
Here are some numbers looking at Maven jars published since 2019: 116,532 jars 4,726 jars that invoke a wrapper constructor (4.1%) 1,031 jars that have more than 10 classes invoking a wrapper constructor (0.9%) If we focus just on the largest projects (jars with >1000 classes): 3,315 jars 1,620 j

Re: Source code analysis: calls to wrapper class constructors

2020-10-21 Thread Dan Smith
> On Oct 19, 2020, at 6:01 PM, Dan Smith wrote: > > In the context of the Warnings for Value-Based Classes JEP, we're looking for > usages of the deprecated wrapper class constructors ('new Integer(...)', 'new > Double(...)', etc.). When do these get used? How often is this motivated by > want