Skip to content

Commit a4a36cb

Browse files
committed
HBX-3194: Remove unused Class parameter from method EntityModelDetector#visitProperty()
Signed-off-by: Koen Aers <koen.aers@gmail.com>
1 parent 76d0c17 commit a4a36cb

File tree

4 files changed

+17
-24
lines changed

4 files changed

+17
-24
lines changed

orm/src/main/java/org/hibernate/tool/internal/export/lint/BadCachingDetector.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ public String getName() {
1313
}
1414

1515
@Override
16-
protected void visitProperty(PersistentClass clazz, Property property, IssueCollector collector) {
16+
protected void visitProperty(Property property, IssueCollector collector) {
1717
Value value = property.getValue();
1818

1919
if(value instanceof Collection) {
20-
Collection col = (Collection) value;
21-
if(col.getCacheConcurrencyStrategy()!=null) { // caching is enabled
20+
Collection col = (Collection) value;
21+
if(col.getCacheConcurrencyStrategy()!=null) { // caching is enabled
2222
if (!col.getElement().isSimpleValue()) {
2323
String entityName = (String) col.getElement().accept( new EntityNameFromValueVisitor() );
2424

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
package org.hibernate.tool.internal.export.lint;
22

3-
import java.util.Iterator;
4-
53
import org.hibernate.mapping.PersistentClass;
64
import org.hibernate.mapping.Property;
75

86
public abstract class EntityModelDetector extends Detector {
97

108
public void visit(IssueCollector collector) {
11-
for (Iterator<PersistentClass> iter = getMetadata().getEntityBindings().iterator(); iter.hasNext();) {
12-
PersistentClass clazz = iter.next();
13-
this.visit(clazz, collector);
14-
}
9+
for (PersistentClass clazz : getMetadata().getEntityBindings()) {
10+
this.visit(clazz, collector);
11+
}
1512
}
1613

1714
protected void visit(PersistentClass clazz, IssueCollector collector) {
@@ -20,13 +17,13 @@ protected void visit(PersistentClass clazz, IssueCollector collector) {
2017

2118
private void visitProperties(PersistentClass clazz, IssueCollector collector) {
2219
if(clazz.hasIdentifierProperty()) {
23-
this.visitProperty(clazz, clazz.getIdentifierProperty(), collector);
20+
this.visitProperty(clazz.getIdentifierProperty(), collector);
2421
}
2522
for (Property property : clazz.getProperties()) {
26-
this.visitProperty(clazz, property, collector);
23+
this.visitProperty(property, collector);
2724
}
2825
}
2926

30-
protected abstract void visitProperty(PersistentClass clazz, Property property, IssueCollector collector);
27+
protected abstract void visitProperty(Property property, IssueCollector collector);
3128

3229
}

orm/src/main/java/org/hibernate/tool/internal/export/lint/InstrumentationDetector.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,23 @@ protected void visit(PersistentClass clazz, IssueCollector collector) {
5353
} else if(enhanceEnabled){
5454
Class<?>[] interfaces = mappedClass.getInterfaces();
5555
boolean enhanced = false;
56-
for (int i = 0; i < interfaces.length; i++) {
57-
Class<?> intface = interfaces[i];
58-
if(intface.getName().equals(Managed.class.getName())) {
59-
enhanced = true;
60-
}
61-
}
56+
for (Class<?> intface : interfaces) {
57+
if (intface.getName().equals(Managed.class.getName())) {
58+
enhanced = true;
59+
break;
60+
}
61+
}
6262

63-
if (enhanceEnabled && !enhanced) {
63+
if (!enhanced) {
6464
collector.reportIssue( new Issue("LAZY_NOT_INSTRUMENTED", Issue.HIGH_PRIORITY, "'" + clazz.getEntityName() + "' has lazy='false', but its class '" + mappedClass.getName() + "' has not been instrumented with javaassist") );
6565
return;
66-
} else {
67-
// unknown bytecodeprovider...can't really check for that.
6866
}
6967

7068
}
7169
}
7270

7371
@Override
7472
protected void visitProperty(
75-
PersistentClass clazz,
7673
Property property,
7774
IssueCollector collector) {
7875
}

orm/src/main/java/org/hibernate/tool/internal/export/lint/ShadowedIdentifierDetector.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.hibernate.tool.internal.export.lint;
22

3-
import org.hibernate.mapping.PersistentClass;
43
import org.hibernate.mapping.Property;
54

65
public class ShadowedIdentifierDetector extends EntityModelDetector {
@@ -10,7 +9,7 @@ public String getName() {
109
}
1110

1211
@Override
13-
protected void visitProperty(PersistentClass clazz, Property property, IssueCollector collector) {
12+
protected void visitProperty(Property property, IssueCollector collector) {
1413
if(property.getName().equals("id")) {
1514
if (property != property.getPersistentClass().getIdentifierProperty()) {
1615
collector.reportIssue(new Issue("ID_SHADOWED", Issue.LOW_PRIORITY, property.getPersistentClass().getEntityName() + " has a normal property named 'id'. This can cause issues since HQL queries will always interpret 'id' as the identifier and not the concrete property"));

0 commit comments

Comments
 (0)