Giter VIP home page Giter VIP logo

Comments (5)

gardner avatar gardner commented on June 23, 2024 1

Thanks for following up on this. This was user error. I didn't have time to push a test project until now. It looks like it was throwing errors because the Object declaration inside the try block. The confusing thing for me was searching on stack overflow and finding many posts discussing the need to nested try finally blocks.

This change shows the user error that caused spotbugs to report the error: https://github.com/gardner/spotbugs-sandbox/pull/1/files

from discuss.

KengoTODA avatar KengoTODA commented on June 23, 2024

Is this code compilable? stmt is declared in try block then it cannot be referred in finally block in theory...

from discuss.

gardner avatar gardner commented on June 23, 2024

Thanks for your question. This code compiles and, by the nature of the java language constructs in use, it definitely does what the findbugs error says it may not do.

from discuss.

KengoTODA avatar KengoTODA commented on June 23, 2024

I'm sure that your code is not compilable, at least following code cannot be compiled:

public class A {
    public void thing1() {
        try {
            Object obj = new Object();
        } finally {
            obj.hashCode();
        }
    }
}

You have another stmt in your code, maybe it's field of your class or its ancestor, I guess.

from discuss.

KengoTODA avatar KengoTODA commented on June 23, 2024

Let me close this issue. Feel free to reopen.

from discuss.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.