Code Monkey home page Code Monkey logo

pelzer-util's People

Contributors

jpelzer avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

pelzer-util's Issues

StopWatch needs a way to be created started

StopWatch class needs a way to be instantiated and started in one call.

Suggestions:
either via constructor
StopWatch(boolean start)

or via a static factory method:
StopWatch.createStarted()

Thanks!

Add threadlocal property logging option

It should be possible to add a threadlocal property to the core Logging class that will, when present, output a string to every entry logged for that thread.

Logging using @com.pelzer.util.Log causes a compilation error when enums or groovy replacements are used

The following code causes Groovy compilation to puke:

package com.pelzer.util

@Log
class GroovyLoggingTest {
  void groovyASTErrorTest() {
    def regularString = "I'm a regular groovy string"
    def stringWithEnum = "I'm a regular groovy-style string, with an enum in me. $Foo.FOO"

    // These lines go through without issue
    log.debug("I'm a log statement that causes no problem.")
    log.debug(stringWithEnum)

    // The following lines cause the compiler to poop the bed.
    log.debug("I have another string in me: $regularString")
    log.debug("$stringWithEnum")
    log.debug("I cause the Groovy compiler to poop the bed $Foo.FOO")
    log.debug("I also cause the Groovy compiler to poop the bed {}", Foo.FOO)
  }

  enum Foo {
    FOO, BAR, JAR
  }
}

This has something to do with the isDebugEnabled or isInfoEnabled calls, as it doesn't happen for warn, error, or fatal logs. It is the enum that triggers it, as far as I can tell. Here's a stacktrace:

Groovyc: java.lang.NullPointerException
    at org.codehaus.groovy.ast.CodeVisitorSupport.visitListOfExpressions(CodeVisitorSupport.java:273)
    at org.codehaus.groovy.ast.CodeVisitorSupport.visitTupleExpression(CodeVisitorSupport.java:178)
    at org.codehaus.groovy.ast.expr.TupleExpression.visit(TupleExpression.java:76)
    at org.codehaus.groovy.ast.CodeVisitorSupport.visitMethodCallExpression(CodeVisitorSupport.java:131)
    at org.codehaus.groovy.control.StaticVerifier.visitMethodCallExpression(StaticVerifier.java:78)
    at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:64)
    at org.codehaus.groovy.ast.CodeVisitorSupport.visitBooleanExpression(CodeVisitorSupport.java:166)
    at org.codehaus.groovy.ast.expr.BooleanExpression.visit(BooleanExpression.java:40)
    at org.codehaus.groovy.ast.CodeVisitorSupport.visitTernaryExpression(CodeVisitorSupport.java:148)
    at org.codehaus.groovy.ast.expr.TernaryExpression.visit(TernaryExpression.java:43)
    at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:69)
    at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:193)
    at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)
    at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:35)
    at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:163)
    at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
    at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:101)
    at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:112)
    at org.codehaus.groovy.control.StaticVerifier.visitConstructorOrMethod(StaticVerifier.java:72)
    at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:123)
    at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1055)
    at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:50)
    at org.codehaus.groovy.control.StaticVerifier.visitClass(StaticVerifier.java:41)
    at org.codehaus.groovy.control.CompilationUnit$5.call(CompilationUnit.java:201)
    at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1036)
    at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:572)
    at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:550)
    at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:527)
    at org.jetbrains.groovy.compiler.rt.GroovyCompilerWrapper.compile(GroovyCompilerWrapper.java:54)
    at org.jetbrains.groovy.compiler.rt.DependentGroovycRunner.runGroovyc(DependentGroovycRunner.java:80)
    at org.jetbrains.groovy.compiler.rt.GroovycRunner.main(GroovycRunner.java:85)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:121)

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.