Updates the reference api for Api Checker to 2.1. Fixes 2 small bugs in Api Checker. Patch by: amitmanjhi Review by: jat Review at http://gwt-code-reviews.appspot.com/1095801 git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@9210 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/build.xml b/build.xml index 5a53310..7bc3744 100755 --- a/build.xml +++ b/build.xml
@@ -31,7 +31,7 @@ </macrodef> <property name="gwt.apicheck.config" - location="tools/api-checker/config/gwt20_21userApi.conf"/> + location="tools/api-checker/config/gwt21_22userApi.conf"/> <target name="buildonly" description="[action] Minimal one-platform devel build, without distro packaging"> @@ -175,8 +175,6 @@ <classpath> <pathelement location="${gwt.build.out}/tools/api-checker/bin"/> <fileset dir="${gwt.build.lib}" includes="gwt-user.jar,gwt-dev.jar" /> - <pathelement location="${gwt.tools.lib}//hibernate/validator/hibernate-validator-4.1.0.Final.jar" /> - <pathelement location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA.jar" /> <pathelement path="${java.class.path}"/> <pathelement location="${gwt.tools.lib}/apache/ant-1.6.5.jar" /> </classpath>
diff --git a/tools/api-checker/config/gwt21_22userApi.conf b/tools/api-checker/config/gwt21_22userApi.conf new file mode 100644 index 0000000..1e4b426 --- /dev/null +++ b/tools/api-checker/config/gwt21_22userApi.conf
@@ -0,0 +1,134 @@ +#existing API + +# dirRoot_old is missing because refJars are being supplied +name_old gwt21userApi +#sourceFiles is specified as colon-separated list of files +sourceFiles_old com/google/gwt + +#excludedFiles is specified as colon-separated ant patterns +excludedFiles_old com/google/gwt/benchmarks/BenchmarkReport.java\ +:com/google/gwt/benchmarks/BenchmarkShell.java\ +:com/google/gwt/benchmarks/client/Benchmark.java\ +:**/linker/**\ +:**/rebind/**\ +:**/server/**\ +:**/tools/**\ +:com/google/gwt/regexp/shared/**\ +:com/google/gwt/autobean/shared/impl/StringQuoter.java\ +:com/google/gwt/core/client/impl/WeakMapping.java\ +:com/google/gwt/core/ext/**\ +:com/google/gwt/dev/*.java\ +:com/google/gwt/dev/asm/**\ +:com/google/gwt/dev/cfg/**\ +:com/google/gwt/dev/generator/**\ +:com/google/gwt/dev/javac/**\ +:com/google/gwt/dev/jdt/**\ +:com/google/gwt/dev/jjs/*.java\ +:com/google/gwt/dev/jjs/ast/**\ +:com/google/gwt/dev/jjs/impl/**\ +:com/google/gwt/dev/js/**\ +:com/google/gwt/dev/json/**\ +:com/google/gwt/dev/resource/**\ +:com/google/gwt/dev/shell/**\ +:com/google/gwt/dev/ui/**\ +:com/google/gwt/dev/util/**\ +:com/google/gwt/junit/*.java\ +:com/google/gwt/junit/client/GWTTestCase.java\ +:com/google/gwt/junit/client/impl/GWTRunner.java\ +:com/google/gwt/junit/remote/**\ +:com/google/gwt/resources/css/**\ +:com/google/gwt/resources/ext/**\ +:com/google/gwt/resources/rg/**\ +:com/google/gwt/requestfactory/shared/impl/MessageFactoryHolder.java\ +:com/google/gwt/rpc/client/impl/ClientWriterFactory.java\ +:com/google/gwt/rpc/client/impl/EscapeUtil.java\ +:com/google/gwt/soyc/**\ +:com/google/gwt/safehtml/shared/SafeHtmlHostedModeUtils.java\ +:com/google/gwt/user/client/rpc/core/java/util/LinkedHashMap_CustomFieldSerializer.java\ +:com/google/gwt/uibinder/attributeparsers/**\ +:com/google/gwt/uibinder/elementparsers/**\ +:com/google/gwt/uibinder/testing/**\ +:com/google/gwt/util/**\ +:com/google/gwt/validation/**\ + +############################################## +#new Api + +dirRoot_new ./ +name_new gwt22userApi +#sourceFiles is specified as colon-separated list of files +sourceFiles_new dev/core/super\ +:user/src\ +:user/super\ + +#excludedFiles is specified as colon-separated ant patterns +# The last 3 entries exclude the validation stuff. +# Bug: http://code.google.com/p/google-web-toolkit/issues/detail?id=5566 +excludedFiles_new user/src/com/google/gwt/benchmarks/BenchmarkReport.java\ +:user/src/com/google/gwt/benchmarks/BenchmarkShell.java\ +:user/src/com/google/gwt/benchmarks/client/Benchmark.java\ +:**/linker/**\ +:**/rebind/**\ +:**/server/**\ +:**/tools/**\ +:user/src/com/google/gwt/regexp/shared/**\ +:user/src/com/google/gwt/autobean/shared/impl/StringQuoter.java\ +:user/src/com/google/gwt/core/client/impl/WeakMapping.java\ +:user/src/com/google/gwt/junit/*.java\ +:user/src/com/google/gwt/junit/client/GWTTestCase.java\ +:user/src/com/google/gwt/junit/client/impl/GWTRunner.java\ +:user/src/com/google/gwt/junit/remote/**\ +:user/src/com/google/gwt/resources/css/**\ +:user/src/com/google/gwt/resources/ext/**\ +:user/src/com/google/gwt/resources/rg/**\ +:user/src/com/google/gwt/requestfactory/shared/impl/MessageFactoryHolder.java\ +:user/src/com/google/gwt/rpc/client/impl/ClientWriterFactory.java\ +:user/src/com/google/gwt/rpc/client/impl/EscapeUtil.java\ +:user/src/com/google/gwt/safehtml/shared/SafeHtmlHostedModeUtils.java\ +:user/src/com/google/gwt/user/client/rpc/core/java/util/LinkedHashMap_CustomFieldSerializer.java\ +:user/src/com/google/gwt/uibinder/attributeparsers/**\ +:user/src/com/google/gwt/uibinder/elementparsers/**\ +:user/src/com/google/gwt/uibinder/testing/**\ +:user/src/com/google/gwt/util/**\ +:user/src/javax/**\ +:user/src/org/**\ +:user/src/com/google/gwt/validation/**\ + +############################################## +#excluded packages colon separated list +excludedPackages com.google.gwt.editor.client.impl\ +:com.google.gwt.requestfactory.client.impl.messages\ +:com.google.gwt.requestfactory.client.impl\ +:com.google.gwt.requestfactory.shared.impl\ + +############################################## +#Api whitelist +# when adding to the white-list, include comments as to why the addition is +# being made. + +# AutoBean packages have been moved since 2.1 +com.google.gwt.editor.client.AutoBean MISSING +com.google.gwt.editor.client.AutoBeanFactory MISSING +com.google.gwt.editor.client.AutoBeanFactory.Category MISSING +com.google.gwt.editor.client.AutoBeanFactory.NoWrap MISSING +com.google.gwt.editor.client.AutoBeanUtils MISSING +com.google.gwt.editor.client.AutoBeanVisitor MISSING +com.google.gwt.editor.client.AutoBeanVisitor.Context MISSING +com.google.gwt.editor.client.AutoBeanVisitor.PropertyContext MISSING + +# Id, Version have been removed because they were not being used. +com.google.gwt.requestfactory.shared.Id MISSING +com.google.gwt.requestfactory.shared.Version MISSING + +# ValueCodex has moved to autobean.shared +com.google.gwt.requestfactory.shared.ValueCodex MISSING + +# The constructor InlineLabel (String, DirectionEstimator) was added. +com.google.gwt.user.client.ui.InlineLabel::InlineLabel(Ljava/lang/String;Lcom/google/gwt/i18n/client/HasDirection$Direction;) OVERLOADED_METHOD_CALL + +# Label's public api has been cleaned since 2.1, for 2.1.1 +com.google.gwt.user.client.ui.Label::getTextOrHtml(Z) MISSING +com.google.gwt.user.client.ui.Label::setHTML(Lcom/google/gwt/safehtml/shared/SafeHtml;) MISSING +com.google.gwt.user.client.ui.Label::setHTML(Lcom/google/gwt/safehtml/shared/SafeHtml;Lcom/google/gwt/i18n/client/HasDirection$Direction;) MISSING +com.google.gwt.user.client.ui.Label::setTextOrHtml(Ljava/lang/String;Lcom/google/gwt/i18n/client/HasDirection$Direction;Z) MISSING +com.google.gwt.user.client.ui.Label::setTextOrHtml(Ljava/lang/String;Z) MISSING
diff --git a/tools/api-checker/reference/README b/tools/api-checker/reference/README index cacb433..2d16479 100644 --- a/tools/api-checker/reference/README +++ b/tools/api-checker/reference/README
@@ -1,2 +1,2 @@ -gwt-dev.jar and gwt-user.jar were extracted from http://google-web-toolkit.googlecode.com/files/gwt-2.0.1.zip +gwt-dev.jar and gwt-user.jar were extracted from http://google-web-toolkit.googlecode.com/files/gwt-2.1.0.zip run ./createApiCheckerReferenceJars.sh
diff --git a/tools/api-checker/reference/gwt-dev-modified.jar b/tools/api-checker/reference/gwt-dev-modified.jar index d6f31e0..acb89d0 100644 --- a/tools/api-checker/reference/gwt-dev-modified.jar +++ b/tools/api-checker/reference/gwt-dev-modified.jar Binary files differ
diff --git a/tools/api-checker/reference/gwt-user-modified.jar b/tools/api-checker/reference/gwt-user-modified.jar index 4e322bf..a057b68 100644 --- a/tools/api-checker/reference/gwt-user-modified.jar +++ b/tools/api-checker/reference/gwt-user-modified.jar Binary files differ
diff --git a/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiCompatibilityChecker.java b/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiCompatibilityChecker.java index d0c1b8a..185ff22 100644 --- a/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiCompatibilityChecker.java +++ b/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiCompatibilityChecker.java
@@ -238,6 +238,9 @@ * Class that specifies a set of {@link CompilationUnit} read from jar files. */ private static class JarFileResources extends Resources { + private static final String MOCK_PREFIX = "/mock/"; + private static final int MOCK_PREFIX_LENGTH = MOCK_PREFIX.length(); + private final ZipScanner excludeScanner; private final Set<String> includedPaths; private final JarFile jarFiles[]; @@ -270,6 +273,9 @@ while (entries.hasMoreElements()) { JarEntry jarEntry = entries.nextElement(); String fileName = jarEntry.toString(); + if (fileName.startsWith(MOCK_PREFIX)) { + fileName = fileName.substring(MOCK_PREFIX_LENGTH); + } if (fileName.endsWith(".java") && isIncluded(fileName)) { // add this compilation unit String fileContent = getFileContentsFromJar(jarFile, jarEntry);
diff --git a/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiContainer.java b/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiContainer.java index 4610de5..d5f9ef2 100644 --- a/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiContainer.java +++ b/tools/api-checker/src/com/google/gwt/tools/apichecker/ApiContainer.java
@@ -274,6 +274,9 @@ * @return return true if and only if the packageObject is an apiPackage */ private boolean isApiPackage(JPackage packageObject) { + if (excludedPackages.contains(packageObject.getName())) { + return false; + } JClassType classTypes[] = packageObject.getTypes(); for (JClassType classType : classTypes) { if (isPublicOuterClass(classType)) {