Skip to content

Apache Lucene open-source search software

LUCENE-2315: AttributeSource's methods for accessing attributes are now final, else its easy to corrupt the internal states

Uwe Schindlerb77a33362cc9
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 67e9246b88c..3fa4f6fbc09 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -138,6 +138,9 @@ Changes in backwards compatibility policy
* LUCENE-2236: Similarity can now be configured on a per-field basis. See the
migration notes in MIGRATE.txt for more details. (Robert Muir, Doron Cohen)
+* LUCENE-2315: AttributeSource's methods for accessing attributes are now final,
+ else its easy to corrupt the internal states. (Uwe Schindler)
+
Changes in Runtime Behavior
* LUCENE-2846: omitNorms now behaves like omitTermFrequencyAndPositions, if you
diff --git a/lucene/src/java/org/apache/lucene/util/AttributeSource.java b/lucene/src/java/org/apache/lucene/util/AttributeSource.java
index c76638f482a..9833fdd61c0 100644
--- a/lucene/src/java/org/apache/lucene/util/AttributeSource.java
+++ b/lucene/src/java/org/apache/lucene/util/AttributeSource.java
@@ -131,14 +131,14 @@ public class AttributeSource {
/**
* returns the used AttributeFactory.
*/
- public AttributeFactory getAttributeFactory() {
+ public final AttributeFactory getAttributeFactory() {
return this.factory;
}
/** Returns a new iterator that iterates the attribute classes
* in the same order they were added in.
*/
- public Iterator<Class<? extends Attribute>> getAttributeClassesIterator() {
+ public final Iterator<Class<? extends Attribute>> getAttributeClassesIterator() {
return Collections.unmodifiableSet(attributes.keySet()).iterator();
}
@@ -146,7 +146,7 @@ public class AttributeSource {
* This iterator may contain less entries that {@link #getAttributeClassesIterator},
* if one instance implements more than one Attribute interface.
*/
- public Iterator<AttributeImpl> getAttributeImplsIterator() {
+ public final Iterator<AttributeImpl> getAttributeImplsIterator() {
if (hasAttributes()) {
if (currentState == null) {
computeCurrentState();