groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-7880) Diamond Operator for own class causes NullPointerException if Static Compilation is enabled
Date Thu, 11 Aug 2016 09:07:20 GMT

    [ https://issues.apache.org/jira/browse/GROOVY-7880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15416912#comment-15416912
] 

ASF GitHub Bot commented on GROOVY-7880:
----------------------------------------

Github user asfgit closed the pull request at:

    https://github.com/apache/groovy/pull/382


> Diamond Operator for own class causes NullPointerException if Static Compilation is enabled
> -------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-7880
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7880
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler, Static compilation, Static Type Checker
>    Affects Versions: 2.4.3, 2.4.7
>         Environment: Test Machine 1: ArchLinux x64,
> openjdk version "1.8.0_92"
> OpenJDK Runtime Environment (build 1.8.0_92-b14)
> OpenJDK 64-Bit Server VM (build 25.92-b14, mixed mode)
> Test Machine 2: MacOSX 10.11.3
> Oracle Java Version: 1.8.0_05
>            Reporter: Roman Leuprecht
>            Priority: Minor
>
> When the diamond operator is used to instantiate a generic and the generic is specialized
on the class the method is in, static compilation fails with a Nullpointer Exception. Dynamic
compilation works, also replacing the diamond operator with the exact type or using "raw"
typing.
> The following code reproduces the bug on both machines(listed in Environment):
> {code:java}
> import groovy.transform.CompileStatic
> @CompileStatic
> class BugTest {
>     private class CompilerKiller<T> {
>         private T t
>         public CompilerKiller(T t){
>             this.t = t
>         }
>     }
>     public void "This causes a NPE"(){
>         CompilerKiller<BugTest> sample = new CompilerKiller<>(this)
>     }
>     public void "This causes a NPE as well"(){
>         CompilerKiller<BugTest> sample = new CompilerKiller<>(new BugTest())
>     }
>     public void "This does work"(){
>         CompilerKiller<BugTest> sample = new CompilerKiller<BugTest>(this)
>     }
>     public void "This works as well"(){
>         CompilerKiller<BugTest> sample = new CompilerKiller(this)
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message