Skip to content

Commit

Permalink
Fix for #808: look for <dl>...</dl> in javadoc and parse parameter names
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Feb 12, 2019
1 parent c1f8850 commit cdb5498
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// GROOVY PATCHED
/*******************************************************************************
* Copyright (c) 2000, 2016 IBM Corporation and others.
*
Expand All @@ -14,6 +15,11 @@
*******************************************************************************/
package org.eclipse.jdt.internal.core;

import java.util.List;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IAnnotation;
Expand Down Expand Up @@ -374,6 +380,17 @@ public void run() {
}
}
if (methodDoc != null) {
// GROOVY add
int indexOfDefsList = methodDoc.indexOf("<dl>");
if (indexOfDefsList != -1) { List<String> names = new ArrayList<>();
String defsList = methodDoc.substring(indexOfDefsList, methodDoc.indexOf("</dl>", indexOfDefsList) + 5);
Matcher matcher = Pattern.compile("<dd><code>(\\p{javaJavaIdentifierPart}+)</code>.*?</dd>").matcher(defsList);
while (matcher.find()) {
names.add(matcher.group(1));
}
return this.parameterNames = names.toArray(new String[names.size()]);
}
// GROOVY end
int indexOfOpenParen = methodDoc.indexOf('(');
// Annotations may have parameters, so make sure we are parsing the actual method parameters.
if (info.getAnnotations() != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// GROOVY PATCHED
/*******************************************************************************
* Copyright (c) 2000, 2016 IBM Corporation and others.
*
Expand All @@ -14,6 +15,11 @@
*******************************************************************************/
package org.eclipse.jdt.internal.core;

import java.util.List;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IAnnotation;
Expand Down Expand Up @@ -374,6 +380,17 @@ public void run() {
}
}
if (methodDoc != null) {
// GROOVY add
int indexOfDefsList = methodDoc.indexOf("<dl>");
if (indexOfDefsList != -1) { List<String> names = new ArrayList<>();
String defsList = methodDoc.substring(indexOfDefsList, methodDoc.indexOf("</dl>", indexOfDefsList) + 5);
Matcher matcher = Pattern.compile("<dd><code>(\\p{javaJavaIdentifierPart}+)</code>.*?</dd>").matcher(defsList);
while (matcher.find()) {
names.add(matcher.group(1));
}
return this.parameterNames = names.toArray(new String[names.size()]);
}
// GROOVY end
int indexOfOpenParen = methodDoc.indexOf('(');
// Annotations may have parameters, so make sure we are parsing the actual method parameters.
if (info.getAnnotations() != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// GROOVY PATCHED
/*******************************************************************************
* Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
Expand All @@ -11,6 +12,11 @@
*******************************************************************************/
package org.eclipse.jdt.internal.core;

import java.util.List;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IAnnotation;
Expand Down Expand Up @@ -358,6 +364,17 @@ public void run() {
}
}
if (methodDoc != null) {
// GROOVY add
int indexOfDefsList = methodDoc.indexOf("<dl>");
if (indexOfDefsList != -1) { List<String> names = new ArrayList<String>();
String defsList = methodDoc.substring(indexOfDefsList, methodDoc.indexOf("</dl>", indexOfDefsList) + 5);
Matcher matcher = Pattern.compile("<dd><code>(\\p{javaJavaIdentifierPart}+)</code>.*?</dd>").matcher(defsList);
while (matcher.find()) {
names.add(matcher.group(1));
}
return this.parameterNames = names.toArray(new String[names.size()]);
}
// GROOVY end
int indexOfOpenParen = methodDoc.indexOf('(');
// Annotations may have parameters, so make sure we are parsing the actual method parameters.
if (info.getAnnotations() != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// GROOVY PATCHED
/*******************************************************************************
* Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
Expand All @@ -11,6 +12,11 @@
*******************************************************************************/
package org.eclipse.jdt.internal.core;

import java.util.List;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IAnnotation;
Expand Down Expand Up @@ -371,6 +377,17 @@ public void run() {
}
}
if (methodDoc != null) {
// GROOVY add
int indexOfDefsList = methodDoc.indexOf("<dl>");
if (indexOfDefsList != -1) { List<String> names = new ArrayList<>();
String defsList = methodDoc.substring(indexOfDefsList, methodDoc.indexOf("</dl>", indexOfDefsList) + 5);
Matcher matcher = Pattern.compile("<dd><code>(\\p{javaJavaIdentifierPart}+)</code>.*?</dd>").matcher(defsList);
while (matcher.find()) {
names.add(matcher.group(1));
}
return this.parameterNames = names.toArray(new String[names.size()]);
}
// GROOVY end
int indexOfOpenParen = methodDoc.indexOf('(');
// Annotations may have parameters, so make sure we are parsing the actual method parameters.
if (info.getAnnotations() != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// GROOVY PATCHED
/*******************************************************************************
* Copyright (c) 2000, 2016 IBM Corporation and others.
*
Expand All @@ -14,6 +15,11 @@
*******************************************************************************/
package org.eclipse.jdt.internal.core;

import java.util.List;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IAnnotation;
Expand Down Expand Up @@ -374,6 +380,17 @@ public void run() {
}
}
if (methodDoc != null) {
// GROOVY add
int indexOfDefsList = methodDoc.indexOf("<dl>");
if (indexOfDefsList != -1) { List<String> names = new ArrayList<>();
String defsList = methodDoc.substring(indexOfDefsList, methodDoc.indexOf("</dl>", indexOfDefsList) + 5);
Matcher matcher = Pattern.compile("<dd><code>(\\p{javaJavaIdentifierPart}+)</code>.*?</dd>").matcher(defsList);
while (matcher.find()) {
names.add(matcher.group(1));
}
return this.parameterNames = names.toArray(new String[names.size()]);
}
// GROOVY end
int indexOfOpenParen = methodDoc.indexOf('(');
// Annotations may have parameters, so make sure we are parsing the actual method parameters.
if (info.getAnnotations() != null) {
Expand Down

0 comments on commit cdb5498

Please sign in to comment.