Coder Social home page Coder Social logo

Project Loom does not play well with synchronized, so WDYT of adding support for "forbid use of synchronized"? about forbidden-apis HOT 3 OPEN

vlsi avatar vlsi commented on June 11, 2024
Project Loom does not play well with synchronized, so WDYT of adding support for "forbid use of synchronized"?

from forbidden-apis.

Comments (3)

uschindler avatar uschindler commented on June 11, 2024 1

Good idea. But this would be an additional "feature" as it requires to not just parse for forbidden methods calls (invoke/invokespecial/invokestatic/getfield/putfield bytecode), but just look at attributes of methods.

  • I have to check how to detect a synchronized block inside bytecode. For method declartion it is just access flag (as far as I remember).
  • Add some setting to enable it globally.
  • Make sure SuppressForbidden works.

from forbidden-apis.

vlsi avatar vlsi commented on June 11, 2024 1

Well, synchronized(something) would use monitorenter bytecode (e.g. https://asm.ow2.io/javadoc/org/objectweb/asm/Opcodes.html#MONITORENTER )

synchronized methods would indeed be coded as method modifiers.

On top of that, it would probably be great to include Object#wait, Object#notify, and Object#notifyAll into the forbidden set as they make sense only in case synchronized is used (they should be replaced with Condition#await, Condition#signal, Condition#signalAll).

I've no idea if synchronized methods or monitorenter could appear in synthetic code, or in the code generated by Kotlin, Scala, or the other compilers.
However, pgjdbc is Java-only for now, so it would be nice to just forbid plain Java synchronized

from forbidden-apis.

uschindler avatar uschindler commented on June 11, 2024

Kotlin must also use monitor enter or attributes on methods, unless they use locks internally. Groovy at least uses it.

from forbidden-apis.

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.