You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2019/12/25 23:22:50 UTC

[commons-bcel] branch master updated: Use Objects.requireNonNull() instead of custom check. Minor formatting.

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git


The following commit(s) were added to refs/heads/master by this push:
     new d9dc495  Use Objects.requireNonNull() instead of custom check. Minor formatting.
d9dc495 is described below

commit d9dc495ba6bdd5f9a39d2c89bf858c35bcd9dc48
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Dec 25 18:22:46 2019 -0500

    Use Objects.requireNonNull() instead of custom check. Minor formatting.
---
 src/main/java/org/apache/bcel/generic/LineNumberGen.java | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/bcel/generic/LineNumberGen.java b/src/main/java/org/apache/bcel/generic/LineNumberGen.java
index 516d611..e8a5668 100644
--- a/src/main/java/org/apache/bcel/generic/LineNumberGen.java
+++ b/src/main/java/org/apache/bcel/generic/LineNumberGen.java
@@ -17,6 +17,8 @@
  */
 package org.apache.bcel.generic;
 
+import java.util.Objects;
+
 import org.apache.bcel.classfile.LineNumber;
 
 /**
@@ -31,7 +33,6 @@ public class LineNumberGen implements InstructionTargeter, Cloneable {
     private InstructionHandle ih;
     private int src_line;
 
-
     /**
      * Create a line number.
      *
@@ -76,12 +77,10 @@ public class LineNumberGen implements InstructionTargeter, Cloneable {
     }
 
 
-    public void setInstruction( final InstructionHandle ih ) { // TODO could be package-protected?
-        if (ih == null) {
-            throw new NullPointerException("InstructionHandle may not be null");
-        }
-        BranchInstruction.notifyTarget(this.ih, ih, this);
-        this.ih = ih;
+    public void setInstruction( final InstructionHandle instructionHandle ) { // TODO could be package-protected?
+        Objects.requireNonNull(instructionHandle, "instructionHandle");
+        BranchInstruction.notifyTarget(this.ih, instructionHandle, this);
+        this.ih = instructionHandle;
     }