Giter VIP home page Giter VIP logo

antipatterns's Issues

Exceptions to PT_FINAL_TYPE_RETURN: Value types and builders?

Value types, e.g. like typed String wrappers, seem to make sense to return verbatim - they should be mocked with values anyway, since mocking breaks the notion of a value type anyway (e.g. equals(), hashCode()).

Builders, furthermore, are often final (as a proxy for their constructors) and will naturally be returned by the modification methods.

(Side note: PT_FINAL_TYPE_CONSTRUCTOR doesn't make sense to me. PT_FINAL_TYPE_RETURN guards against final types returned from methods, because someone might want to mock those methods - in turn, they might want to mock the returned objects as well, which doesn't work if the return type is final. But how exactly would one mock a constructor?)

Antipatterns produces some pretty epic exceptions if classes are not found

palantir/gradle-processors excludes certain classes from being analysed by findbugs. Antipatterns blows up when trying to analyse classes that extend these types.

  Exception analyzing INTERNALCLASSNAME using detector com.palantir.antipatterns.FinalSignatureDetector
    java.lang.RuntimeException: java.lang.ClassNotFoundException: Class not found: ImmutableINTERNALCLASSNAME
      At com.palantir.antipatterns.FinalSignatureDetector.isIllegalFinalType(FinalSignatureDetector.java:86)
      At com.palantir.antipatterns.FinalSignatureDetector.visitClassContext(FinalSignatureDetector.java:47)
      At edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:76)
      At edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1089)
      At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:283)
      At org.gradle.api.plugins.quality.internal.findbugs.FindBugsExecuter.runFindbugs(FindBugsExecuter.java:39)
      At sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      At sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      At sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      At java.lang.reflect.Method.invoke(Method.java:498)
      At org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:87)
      At org.gradle.process.internal.worker.request.WorkerAction.runThenStop(WorkerAction.java:71)
      At sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      At sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      At sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      At java.lang.reflect.Method.invoke(Method.java:498)
      At org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
      At org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
      At org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:377)
      At org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
      At org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
      At java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      At java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      At java.lang.Thread.run(Thread.java:745)

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.