Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid class name exception for methods with generics #724

Open
pavelorehov opened this issue Feb 13, 2024 · 2 comments
Open

Invalid class name exception for methods with generics #724

pavelorehov opened this issue Feb 13, 2024 · 2 comments
Labels

Comments

@pavelorehov
Copy link

pavelorehov commented Feb 13, 2024

As continue of #669 still fails with 1.12.0

fails on return value of method:
public Map<String, String> test1()

Full class example:

import java.util.Map;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

	// fails
	/*
	 * [java] The following errors occurred during analysis:
     [java]   Exception analyzing TestController using detector com.h3xstream.findsecbugs.spring.SpringEntityLeakDetector
     [java]     java.lang.IllegalArgumentException: Invalid class name java/lang/String;Ljava/lang/String
     [java]       At edu.umd.cs.findbugs.classfile.ClassDescriptor.<init>(ClassDescriptor.java:59)
     [java]       At edu.umd.cs.findbugs.classfile.DescriptorFactory.getClassDescriptor(DescriptorFactory.java:128)
     [java]       At edu.umd.cs.findbugs.AnalysisCacheToRepositoryAdapter.loadClass(AnalysisCacheToRepositoryAdapter.java:90)
     [java]       At org.apache.bcel.Repository.lookupClass(Repository.java:180)
     [java]       At com.h3xstream.findsecbugs.spring.SignatureParserWithGeneric.typeToJavaClass(SignatureParserWithGeneric.java:75)
	 */
	@GetMapping(value = "/test1", produces = MediaType.APPLICATION_JSON_VALUE)
    public Map<String, String> test1() {
		return Map.of();
	}
	
	// work
	@GetMapping(value = "/test2", produces = MediaType.TEXT_PLAIN_VALUE)
    public String test2() {
		return "OK";
	}
}
@gtoison
Copy link
Contributor

gtoison commented Mar 1, 2024

@pavelorehov have you tried with 1.13.0 ?

@pavelorehov
Copy link
Author

Hi, yes, that issue got resolved with findsecbugs-plugin:1.13.0 and spotbugs-maven-plugin:4.8.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants