[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-hotspot-runtime-dev
Subject:    Re: RFR: 8298065: Provide more information in message of NoSuchFieldError [v4]
From:       Matias Saavedra Silva <matsaave () openjdk ! org>
Date:       2022-12-23 21:39:49
Message-ID: nPkhJVsVlzf_pZn2z8NUF2eD8JOgiRUxyvYLltAo3CA=.111936a2-ed82-4105-86e4-ccae37e538bd () github ! com
[Download RAW message or body]

On Fri, 23 Dec 2022 18:17:12 GMT, Matias Saavedra Silva <matsaave@openjdk.org> wrote:

> > src/hotspot/share/runtime/signature.cpp line 455:
> > 
> > > 453:       strncat(buf, "[]", strlen(buf));
> > > 454:       buf[strlen(buf)] = '\0';
> > > 455:     }
> > 
> > Java array dimensions can be up to 255, so the `buf` is not long enough.
> > 
> > Anyway, I think we already have code that can translate a signature like `[I` to \
> > the source code form of `int []`. Try this: 
> > 
> > super class Foofoo
> > 	version 63:0
> > {
> > public static Method main:"([Ljava/lang/String;)V"
> > 	stack 30 locals 3
> > {
> > iconst_0;
> > iconst_0;
> > aconst_null;
> > 		invokestatic	Method "xxx":"(II[I)V";
> > 		return;
> > }
> > } 
> > 
> > $ java -cp . Foofoo
> > Exception in thread "main" java.lang.NoSuchMethodError: 'void Foofoo.xxx(int, \
> > int, int[])'  at Foofoo.main(Foofoo.jasm)
> > 
> > 
> > Writing such conversion is very difficult. You should try to use the existing \
> > code (refactoring it as necessary).
> 
> After a while of searching I was unable to find anything that could easily provide \
> this type of information. The closest example is \
> Signature::print_as_signature_external_return_type, but this does not work with \
> fields.

Ignore my above comment, I found a way to rework a method in symbol.cpp to accomplish \
the same task more safely. Thank you for this!

-------------

PR: https://git.openjdk.org/jdk/pull/11745


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic