Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
7903319: The methods 'getAllMethods' and 'getMethods' in class 'Bench…
…markGeneratorUtils' have the same feature

Reviewed-by: shade
  • Loading branch information
lgxbslgx authored and shipilev committed Sep 20, 2022
1 parent dfb595b commit 8c7fedc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -138,14 +138,6 @@ public static Collection<MethodInfo> getAllMethods(ClassInfo ci) {
return ls;
}

public static Collection<MethodInfo> getMethods(ClassInfo ci) {
List<MethodInfo> ls = new ArrayList<>();
do {
ls.addAll(ci.getMethods());
} while ((ci = ci.getSuperClass()) != null);
return ls;
}

public static <T extends Annotation> T getAnnSuper(ClassInfo ci, Class<T> annClass) {
T ann = ci.getAnnotation(annClass);
if (ann != null) {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -128,7 +128,7 @@ public static void validateState(ClassInfo state) {
}

// validate rogue annotations on methods
for (MethodInfo mi : BenchmarkGeneratorUtils.getMethods(state)) {
for (MethodInfo mi : BenchmarkGeneratorUtils.getAllMethods(state)) {
BenchmarkGeneratorUtils.checkAnnotations(mi);
}

Expand Down Expand Up @@ -252,7 +252,7 @@ private static void validateNoCyclesStep(Set<ClassQName> alreadySeen, MethodInfo
Set<ClassQName> nextSeen = new HashSet<>();
nextSeen.addAll(alreadySeen);
nextSeen.add(ci);
for (MethodInfo mi : BenchmarkGeneratorUtils.getMethods(ci.ci)) {
for (MethodInfo mi : BenchmarkGeneratorUtils.getAllMethods(ci.ci)) {
if (mi.getAnnotation(Setup.class) != null || mi.getAnnotation(TearDown.class) != null) {
validateNoCyclesStep(nextSeen, mi, false);
}
Expand Down Expand Up @@ -286,7 +286,7 @@ public int hashCode() {
*/
private void resolveDependencies(MethodInfo method, ClassInfo pci, StateObject pso) {

for (MethodInfo mi : BenchmarkGeneratorUtils.getMethods(pci)) {
for (MethodInfo mi : BenchmarkGeneratorUtils.getAllMethods(pci)) {
if (mi.getAnnotation(Setup.class) != null || mi.getAnnotation(TearDown.class) != null) {
for (ParameterInfo pi : mi.getParameters()) {
ClassInfo ci = pi.getType();
Expand Down Expand Up @@ -372,7 +372,7 @@ private void bindState(MethodInfo execMethod, StateObject so, ClassInfo ci) {
}

// put the @State objects helper methods
for (MethodInfo mi : BenchmarkGeneratorUtils.getMethods(ci)) {
for (MethodInfo mi : BenchmarkGeneratorUtils.getAllMethods(ci)) {
Setup setupAnn = mi.getAnnotation(Setup.class);
if (setupAnn != null) {
checkHelpers(mi, Setup.class);
Expand Down

0 comments on commit 8c7fedc

Please sign in to comment.