matthiasblaesing commented on code in PR #5432:
URL: https://github.com/apache/netbeans/pull/5432#discussion_r1096798104
##########
ide/css.lib/src/org/netbeans/modules/css/lib/properties/GrammarParser.java:
##########
@@ -372,4 +386,59 @@ public CharSequence readText() {
return text.subSequence(0, pos);
}
}
+
+ private static class PropertyGrammarElementRef {
+ private final GrammarElement parent;
+ private final int index;
+ private final String propertyName;
+
+ public PropertyGrammarElementRef(GrammarElement parent, int index,
String propertyName) {
+ this.parent = parent;
+ this.index = index;
+ this.propertyName = propertyName;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 29 * hash + this.index;
+ hash = 29 * hash + Objects.hashCode(this.propertyName);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final PropertyGrammarElementRef other =
(PropertyGrammarElementRef) obj;
+ if (this.index != other.index) {
+ return false;
+ }
+ if (!Objects.equals(this.propertyName, other.propertyName)) {
+ return false;
+ }
+ return
truncatedPath(this.parent).equals(truncatedPath(other.parent));
+ }
+
+ @SuppressWarnings("AssignmentToMethodParameter")
+ private String truncatedPath(GrammarElement parent) {
+ StringBuilder path = new StringBuilder();
+ while(parent != null) {
+ path.append(parent.getName());
+ path.append("/");
+ if(parent.getName() != null) {
Review Comment:
Yes implementation of `PropertyGrammarElementRef` was bogus. Addressed via:
https://github.com/apache/netbeans/pull/5432/commits/ecd64eee0b30d600967c751cae5281cf842daa1a
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists