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

Karl Heinz Marbaise commented on MNG-5649:
------------------------------------------

For the typical check on null arguments i would suggest to use the default JDK 
7 solution, and yes this will throw an NPE, cause it is an NPE with an 
appropriate message exactly shows what is wrong...
{code:java}
this.whatever = Objects.requireNoneNull(...);
{code}
which is also available in JDK8/JDK9...

And for the others i would vote for Apache Commons ?...

I have checked the code at the moment we have the following references to 
{{com.google.*}}
{noformat}
./maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelResolver.java
./maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenAetherModule.java
./maven-core/src/main/java/org/apache/maven/DefaultMaven.java
./maven-core/src/main/java/org/apache/maven/SessionScoped.java
./maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
./maven-core/src/main/java/org/apache/maven/execution/scope/MojoExecutionScoped.java
./maven-core/src/main/java/org/apache/maven/execution/scope/internal/MojoExecutionScope.java
./maven-core/src/main/java/org/apache/maven/execution/scope/internal/MojoExecutionScopeModule.java
./maven-core/src/main/java/org/apache/maven/extension/internal/CoreExports.java
./maven-core/src/main/java/org/apache/maven/extension/internal/CoreExtensionEntry.java
./maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
./maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycles.java
./maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java
./maven-core/src/main/java/org/apache/maven/project/ProjectModelResolver.java
./maven-core/src/main/java/org/apache/maven/session/scope/internal/SessionScope.java
./maven-core/src/main/java/org/apache/maven/session/scope/internal/SessionScopeModule.java
./maven-core/src/test/java/org/apache/maven/execution/scope/internal/MojoExecutionScopeTest.java
./maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
./maven-model-builder/src/main/java/org/apache/maven/model/building/Result.java
{noformat}
In other words most of the references to Google Guava shouldn't be a big issue 
to remove / replace with others...


> Stop abusing IllegalArgumentException in case of null and use Guava's 
> Preconditions
> -----------------------------------------------------------------------------------
>
>                 Key: MNG-5649
>                 URL: https://issues.apache.org/jira/browse/MNG-5649
>             Project: Maven
>          Issue Type: Bug
>    Affects Versions: 3.2.1
>            Reporter: Michael Osipov
>            Assignee: Michael Osipov
>             Fix For: 3.3.7
>
>
> In several spots of Maven Core, IAE is thrown where an argument is null. This 
> should be turned into {{NullPointerException}} since JDK adheres to is and 
> the 
> [description|http://docs.oracle.com/javase/6/docs/api/java/lang/NullPointerException.html]
>  of this exception indicates that and Effective Java does that too.
> I possible fix version could next minor: 3.3. Is no one is opposed it could 
> even be 3.2.2.



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

Reply via email to