question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getParameterInfo - NullPointerException

See original GitHub issue

Hi, I tried to get info about parameters in method. But I catch an exception:

System.out.println(Arrays.toString(method.getParameterInfo()));
Exception in thread "Thread-6" java.lang.NullPointerException
	at io.github.classgraph.MethodParameterInfo.getAnnotationInfo(MethodParameterInfo.java:138)
	at io.github.classgraph.MethodParameterInfo.toString(MethodParameterInfo.java:167)

Snippet of scaner:

try (ScanResult scanResult = new ClassGraph()
        .enableAllInfo()
        .enableSystemPackages()
        .disableJarScanning()
        .disableDirScanning()
        .whitelistPackages("java", "java.lang", "javax", "javafx")
        .blacklistPackages("java.applet", "java.awt")
        .scan()) {
// ...
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lukehutchcommented, Aug 26, 2018

@MrChebik Glad it’s working for you with the latest version.

See the Javadoc for MethodParameterInfo#getName():

https://github.com/classgraph/classgraph/blob/master/src/main/java/io/github/classgraph/MethodParameterInfo.java#L74

You need to compile your code with the -parameters switch (and you have to be using JDK 8+) for method parameter names to be stored in the classfile by the compiler. If you don’t do that, then the toString() method just uses “_unnamed_param” instead.

(Eclipse has its own equivalent config option to the -parameters switch.)

1reaction
lukehutchcommented, Aug 26, 2018

Hi @MrChebik, I believe this is a bug that was fixed a few versions ago. Can you please test with the latest version and see if it resolves the problem?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unknown Source/NullPointerException accessing java script ...
If non-commented, then I get the same error message on line "getParameterInfo().length" as I get for eval function . Any ideas? Thanks,
Read more >
Reading Image file using HTTP Server request : Null Pointer ...
I have developed a service , which gets Image file from HTTP client; input.getRequest().getByteArray() returns NULL, but I..
Read more >
RE: RpcException$Companion.callFailed : FL-16271 - YouTrack
ParameterInfoApi#getParameterInfo> has failed: Failure[java.lang.NullPointerException: Parameter specified as non-null is null: method ...
Read more >
RequestContext (CDS Services API 1.19.0 API) - javadoc.io
This method will throw a NullPointerException , if the passed CdsRuntime was null, but guarantees that it will never ... ParameterInfo getParameterInfo().
Read more >
GetParameterInfo—ArcGIS Pro | Documentation
Display some parameter object properties for the specified tool. import arcpy # Load tool parameter objects into list. params = arcpy.GetParameterInfo("HotSpots ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found