-
Notifications
You must be signed in to change notification settings - Fork 874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed key escaping; fixed list/map property extraction. #5535
Conversation
return; | ||
} | ||
if (clazz.isEnum() || clazz.isArray()) { | ||
if (clazz.isArray() || (excludes == null && ignoreClassesPattern.matcher(clazz.getName()).matches())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition for shortcut path remain the same; but now the implementation tries to export Maps and Lists. Covers the case when inspectObjectAndValues0
is called for e.g. java.util.HashMap object, which is otherwise excluded by filters - i.e. Map inside a Map.
defaultValues.put(prefix + propName + "." + k, Objects.toString(v)); // NOI18N | ||
inspectObjectAndValues(v.getClass(), v, newPrefix, globalTypes, propertyTypes, defaultValues, null, false); | ||
} | ||
dumpContainerProperties(m, prefix + propName, defaultValues); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extracted into a method, to allow call from `inspectExtensions'.
dumped = true; | ||
} | ||
} else { | ||
dumped = dumpValue(value, prefix + propName, propertyTypes, defaultValues, t, typeParameters); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extracted into a method so that inspectObjectAndValues can call that for j.u.HashMap from line 579
@@ -811,14 +885,23 @@ private void inspectExtensions(String prefix, ExtensionContainer container) { | |||
|
|||
Object ext; | |||
try { | |||
ext = project.getExtensions().getByName(extName); | |||
ext = container.getByName(extName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was a bug !! The extension enumerated from a domain object was always looked up as extension of a project itself.
b3dca4a
to
8afa04b
Compare
Rebased onto latest master; resolved conflicts with @tbw777 changes to |
propertyTypes.merge(prefix + COLLECTION_KEYS_MARKER, String.join(";;", keys), (old, add) -> { | ||
List<String> oldList = new ArrayList<>(Arrays.asList(old.split(";;"))); | ||
List<String> newList = Arrays.asList(add.split(";;")); | ||
oldList.addAll(newList); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about ?
Collections.addAll(oldList, add.split(";;"));
ping ... |
prop = support.findExtensionProperty("graalvmNative", "binaries.main.buildArgs"); | ||
assertEquals(BuildPropertiesSupport.PropertyKind.LIST, prop.getKind()); | ||
Iterable<BuildPropertiesSupport.Property> it = support.items(prop, null); | ||
assertNotNull(it); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems redundant, next line will throw NPE if it == null and the test will fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks Ok.
extide/gradle/src/org/netbeans/modules/gradle/loaders/ExtensionPropertiesExtractor.java
Outdated
Show resolved
Hide resolved
8f0cfa2
to
773eca8
Compare
This PR initially started from reviewing this change as the intention was to un-escape ';' sequence to ';'. Then as I attempted to write tests, I've found a few rough edges of the BuildProperties API ...
Some highlights here, minor commnents inline in the diff.
1/ Gradle defines an extensibility 'ext' container for most domain object, where extra properties can be defined. After definition, they become 'part of' the domain object itself and can be referenced as such. Those extra properties were not exported in the project info. Now they're exported into the domain object's namespace.
2/ Structures (structured things that are not Maps) get their keys enumerated. Allows for introspection in NB IDE