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

Code compiled with target 11 (and not 1.8) does not find all bug warnings #465

Open
lgemeinhardt opened this issue Feb 8, 2024 · 1 comment

Comments

@lgemeinhardt
Copy link

This sample code should find the "LO_APPENDED_STRING_IN_FORMAT_STRING" bug warning :

package sample;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class Sample {

	private static final Logger LOG = LogManager.getLogger();

	public static void main(final String[] args) {
		LOG.error("main args " + args.length); // should raise LO_APPENDED_STRING_IN_FORMAT_STRING bug warning
	}

}

And does it, if compiled with target 1.8, but not if compiled with target 11.
Tested with JDK 11, 17 and 21.

@lgemeinhardt lgemeinhardt changed the title Code compiled with target 11 (and not 1.8) does not find all bugs warnings Code compiled with target 11 (and not 1.8) does not find all bug warnings Feb 8, 2024
@mebigfatguy
Copy link
Owner

The issue is the compiler is chosing

void error(Object message);

rather than

void error(String message);

so that check is bypassed. can be fixed.

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

No branches or pull requests

2 participants