< prev index next >
src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/MethodGen.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -37,14 +37,14 @@
import com.sun.org.apache.bcel.internal.classfile.RuntimeVisibleParameterAnnotations;
import com.sun.org.apache.bcel.internal.classfile.Utility;
import com.sun.org.apache.bcel.internal.util.BCELComparator;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Stack;
/**
* Template class for building up a method. This is done by defining exception
* handlers, adding thrown exceptions, local variables and attributes, whereas
@@ -53,14 +53,13 @@
*
* While generating code it may be necessary to insert NOP operations. You can
* use the `removeNOPs' method to get rid off them.
* The resulting method object can be obtained via the `getMethod()' method.
*
- * @version $Id$
* @see InstructionList
* @see Method
- * @LastModified: Jun 2019
+ * @LastModified: Jan 2020
*/
public class MethodGen extends FieldGenOrMethodGen {
private String class_name;
private Type[] arg_types;
@@ -84,12 +83,12 @@
@Override
public boolean equals( final Object o1, final Object o2 ) {
final MethodGen THIS = (MethodGen) o1;
final MethodGen THAT = (MethodGen) o2;
- return THIS.getName().equals(THAT.getName())
- && THIS.getSignature().equals(THAT.getSignature());
+ return Objects.equals(THIS.getName(), THAT.getName())
+ && Objects.equals(THIS.getSignature(), THAT.getSignature());
}
@Override
public int hashCode( final Object o ) {
@@ -355,16 +354,11 @@
if ((lg[i].getEnd() == null) && (il != null)) {
lg[i].setEnd(il.getEnd());
}
}
if (size > 1) {
- Arrays.sort(lg, new Comparator<LocalVariableGen>() {
- @Override
- public int compare(final LocalVariableGen o1, final LocalVariableGen o2) {
- return o1.getIndex() - o2.getIndex();
- }
- });
+ Arrays.sort(lg, (o1, o2) -> o1.getIndex() - o2.getIndex());
}
return lg;
}
< prev index next >