eclipse-jdt / eclipse.jdt.core

Eclipse Public License 2.0
168 stars 133 forks source link

Marker property value is too long #1269

Open henols opened 1 year ago

henols commented 1 year ago

Im trying to refresh a quite big Gradle project and it wont build properly since I get this entry in the Error Log.

**eclipse.buildId=4.28.0.20230608-1200 java.version=17.0.8 java.vendor=Eclipse Adoptium BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US Framework arguments: -product org.eclipse.epp.package.java.product Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product

org.eclipse.core.resources Error Fri Aug 04 16:21:17 CEST 2023 Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".

org.eclipse.core.runtime.AssertionFailedException: assertion failed: Marker property value is too long: One or more cycles were detected in the build path of project 'ai-application-eclipseclient-test'. The paths towards the cycle and cycle are: ai-application-eclipseclient-test->{rest-dependencyanalysis, rest-wuirenderdocument} ai-application-eclipseclient-test->{rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl} ai-application-eclipseclient-test, rest-dependencyanalysis->{rest-wuirenderdocument, developmentmodule-manager-impl} ai-application-eclipseclient-test->{rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport} ai-application-eclipseclient-test, rest-dependencyanalysis->{rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument->{developmentmodule-manager-impl, xmlimport} ai-application-eclipseclient-test->{rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader} ai-application-eclipseclient-test, rest-dependencyanalysis->{rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument->{developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl->{xmlimport, variantcodeproposer-impl, knockdown-rule-loader} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport->{variantcodeproposer-impl, knockdown-rule-loader} ai-application-eclipseclient-test->{rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common} ai-application-eclipseclient-test, rest-dependencyanalysis->{rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument->{developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl->{xmlimport, variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport->{variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader->{rest-primeprocessors, integration-common} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl->{knockdown-rule-loader, rest-primeprocessors, integration-common, confirming-info-operations} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common->{confirming-info-operations, valueproposer-impl} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl->{knockdown-rule-loader, rest-primeprocessors, integration-common, confirming-info-operations, valueproposer-impl, eco-application} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common, confirming-info-operations->{valueproposer-impl, eco-application} ai-application-eclipseclient-test->{rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common, confirming-info-operations, valueproposer-impl, eco-application, server-plugins} ai-application-eclipseclient-test, rest-dependencyanalysis->{rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common, confirming-info-operations, valueproposer-impl, eco-application, server-plugins} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument->{developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common, confirming-info-operations, valueproposer-impl, eco-application, server-plugins} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl->{xmlimport, variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common, confirming-info-operations, valueproposer-impl, eco-application, server-plugins} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport->{variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common, confirming-info-operations, valueproposer-impl, eco-application, server-plugins} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader->{rest-primeprocessors, integration-common, confirming-info-operations, valueproposer-impl, eco-application, server-plugins} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common->{confirming-info-operations, valueproposer-impl, eco-application, server-plugins} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common, confirming-info-operations, valueproposer-impl->{eco-application, server-plugins} ai-application-eclipseclient-test->{rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common, confirming-info-operations, valueproposer-impl, eco-application, server-plugins, result-cursor-impl} ai-application-eclipseclient-test, rest-dependencyanalysis->{rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common, confirming-info-operations, valueproposer-impl, eco-application, server-plugins, result-cursor-impl} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument->{developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common, confirming-info-operations, valueproposer-impl, eco-application, server-plugins, result-cursor-impl} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl->{xmlimport, variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common, confirming-info-operations, valueproposer-impl, eco-application, server-plugins, result-cursor-impl} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport->{variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common, confirming-info-operations, valueproposer-impl, eco-application, server-plugins, result-cursor-impl} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader->{rest-primeprocessors, integration-common, confirming-info-operations, valueproposer-impl, eco-application, server-plugins, result-cursor-impl} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common->{confirming-info-operations, valueproposer-impl, eco-application, server-plugins, result-cursor-impl} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common, confirming-info-operations, valueproposer-impl->{eco-application, server-plugins, result-cursor-impl} ai-application-eclipseclient-test, rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common, confirming-info-operations, valueproposer-impl->{eco-application, server-plugins, result-cursor-impl, prototypeindividual-manager-api} ai-application-eclipseclient-test->{rest-dependencyanalysis, rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration-common, confirming-info-operations, valueproposer-impl, eco-application, server-plugins, result-cursor-impl, service-executor-manager-ejb} ai-application-eclipseclient-test, rest-dependencyanalysis->{rest-wuirenderdocument, developmentmodule-manager-impl, xmlimport, variantcodeproposer-impl, knockdown-rule-loader, rest-primeprocessors, integration- at org.eclipse.core.runtime.Assert.isTrue(Assert.java:113) at org.eclipse.core.internal.resources.MarkerInfo.checkValidAttribute(MarkerInfo.java:59) at org.eclipse.core.internal.resources.MarkerAttributeMap.putAll(MarkerAttributeMap.java:110) at org.eclipse.core.internal.resources.MarkerAttributeMap.lambda$0(MarkerAttributeMap.java:96) at java.base/java.util.concurrent.atomic.AtomicReference.getAndUpdate(AtomicReference.java:188) at org.eclipse.core.internal.resources.MarkerAttributeMap.putAll(MarkerAttributeMap.java:94) at org.eclipse.core.internal.resources.MarkerInfo.addAttributes(MarkerInfo.java:170) at org.eclipse.core.internal.resources.Marker.setAttributes(Marker.java:306) at org.eclipse.jdt.internal.core.JavaProject.createClasspathProblemMarker(JavaProject.java:1265) at org.eclipse.jdt.internal.core.JavaProject.validateCycles(JavaProject.java:491) at org.eclipse.jdt.internal.core.DeltaProcessor.resourceChanged(DeltaProcessor.java:2215) at org.eclipse.jdt.internal.core.DeltaProcessingState.resourceChanged(DeltaProcessingState.java:501) at org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:307) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45) at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:297) at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:160) at org.eclipse.core.internal.resources.Workspace.broadcastBuildEvent(Workspace.java:374) at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:191) at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:289) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

**

jukzi commented 1 year ago

The maximum marker size is 65535. However you should fix the root cause of cyclic dependency anyway: One or more cycles were detected in the build path of project 'ai-application-eclipseclient-test

iloveeclipse commented 1 year ago

@jukzi : surely the problem can be fixed by user, but what should user do if we are unable to report the problem and break the build (which would most likely just continue to build other stuff).

jukzi commented 1 year ago

such an error is also logged when running org.eclipse.jdt.core.tests.model.JavaSearchScopeTests

jukzi commented 1 year ago

A possible solution for jdt:

diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java
index 8db6515..3f50a3b 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java
@@ -1261,6 +1261,7 @@

        try {
            marker = this.project.createMarker(IJavaModelMarker.BUILDPATH_PROBLEM_MARKER);
+           String message = status.getMessage();
            marker.setAttributes(
                new String[] {
                    IMarker.MESSAGE,
@@ -1275,7 +1276,7 @@
                    IMarker.SOURCE_ID,
                },
                new Object[] {
-                   status.getMessage(),
+                   message.substring(0, Math.min(message.length(), 65535)),
                    Integer.valueOf(severity),
                    Messages.classpath_buildPath,
                    isCycleProblem ? "true" : "false",//$NON-NLS-1$ //$NON-NLS-2$
szarnekow commented 1 year ago
  • message.substring(0, Math.min(message.length(), 65535)),

It's the bytes that are relevant, not the char length. See org.eclipse.core.internal.resources.MarkerInfo.checkValidAttribute(Object)

henols commented 1 year ago

@jukzi If you are still on it I think this will do the trick.

        ByteBuffer buff = ByteBuffer.allocate(65535);
        encoder.encode(CharBuffer.wrap(status.getMessage()), buff, true);
        marker.setAttributes(
            new String[] {
                IMarker.MESSAGE,
                IMarker.SEVERITY,
                IMarker.LOCATION,
                IJavaModelMarker.CYCLE_DETECTED,
                IJavaModelMarker.CLASSPATH_FILE_FORMAT,
                IJavaModelMarker.OUTPUT_OVERLAPPING_SOURCE,
                IJavaModelMarker.ID,
                IJavaModelMarker.ARGUMENTS ,
                IJavaModelMarker.CATEGORY_ID,
                IMarker.SOURCE_ID,
            },
            new Object[] {
                new String(buff.array(), 0, buff.position(), StandardCharsets.UTF_8),
                Integer.valueOf(severity),
                Messages.classpath_buildPath,
                isCycleProblem ? "true" : "false",//$NON-NLS-1$ //$NON-NLS-2$
                isClasspathFileFormatProblem ? "true" : "false",//$NON-NLS-1$ //$NON-NLS-2$
                isOutputOverlapping ? "true" : "false", //$NON-NLS-1$ //$NON-NLS-2$
                Integer.valueOf(status.getCode()),
                Util.getProblemArgumentsForMarker(arguments) ,
                Integer.valueOf(CategorizedProblem.CAT_BUILDPATH),
                JavaBuilder.SOURCE_ID,
            }
        );
jukzi commented 1 year ago

@henols can you create a PR please?

in your solution i think it's overkill to always allocate ByteBuffer.allocate(65535). allocate min(message length,655535) at max.

henols commented 1 year ago

Can't make a proper PR since I can't make the project to work, will try and se what I can do. Maybe it can be done without allocate and set a max size but i didn't see that. No point of trying to check the message length since its unknown how many bytes the string consists of, thats why ByteBuffer is used to tell how many bytes were actually stored inside the allowed size.

On Thu, 28 Sept 2023 at 09:12, Jörg Kubitz @.***> wrote:

@henols https://github.com/henols can you create a PR please?

in your solution i think it's overkill to always allocate ByteBuffer.allocate(65535). allocate min(message length,655535) at max.

— Reply to this email directly, view it on GitHub https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1269#issuecomment-1738602541, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATJAYZBYOMG3HDWCMPE64LX4UPMRANCNFSM6AAAAAA3EJULYU . You are receiving this because you were mentioned.Message ID: @.***>

--

Work greener, don't print unless you need to!

jukzi commented 1 year ago

I can't make the project to work,

https://github.com/eclipse-platform/.github/blob/main/CONTRIBUTING.md