PHPsrc / org.phpsrc.eclipse.pti.tool.phpunit

PHP Tool Integration PHPUnit Plugin
2 stars 3 forks source link

Stack Overflow Exception when running Symfony WebTests #1

Open fogs opened 11 years ago

fogs commented 11 years ago

First of all: thanks a lot for the great Eclipse Plugin!

Recently, I stumbled across a bug: when running a Symfony WebTest using PTI, I can see PTI starting in the Progress View but being stuck at 0%. After a while I get the following error message:

An internal error occurred during: "PHPUnit". java.lang.StackOverflowError

The Eclipse log contains vast amounts of these two lines:

    at org.phpsrc.eclipse.pti.core.PHPToolkitUtil.hasSuperClass(PHPToolkitUtil.java:418)
    at org.phpsrc.eclipse.pti.core.PHPToolkitUtil.hasSuperClass(PHPToolkitUtil.java:391)

A regular PHPUnit_Framework_TestCase in the same project works fine.

A Symfony WebTest looks like this:

namespace Acme\DemoBundle\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class DemoControllerTest extends WebTestCase
{
    [..]
}

The parent class WebTestCase looks like this: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php

If I understand PTI's code right, PHPToolkitUtil tries to find the right Superclass. Unfortunately, the class name WebTestCase exists several times in the project.

After renaming above mentioned WebTestCase class to WebTestCase2 (in my test case and the class itself), it works fine. However, this looks more like an issue that needs to be fixed within PTI rather than changing Symfony code. Duplicate class names should not be the problem, thats what namespaces are there for.

Let me know if you need more information on this issue.

maikgreubel commented 9 years ago

+1

At least it would be helpful to identify which of my classes is causing the problem. As workarround the validation of PHPDepend Metrics Validator has to disabled or only activated for manual validation. Here is a stacktrace:

!ENTRY org.eclipse.core.jobs 4 2 2015-05-10 12:27:18.999
!MESSAGE An internal error occurred during: "Validating".
!STACK 0
java.lang.StackOverflowError
    at org.eclipse.core.internal.filesystem.local.LocalFileNatives.internalGetFileInfoW(Native Method)
    at org.eclipse.core.internal.filesystem.local.LocalFileNatives.fetchFileInfo(LocalFileNatives.java:112)
    at org.eclipse.core.internal.filesystem.local.LocalFileHandler.fetchFileInfo(LocalFileHandler.java:26)
    at org.eclipse.core.internal.filesystem.local.LocalFileNativesManager.fetchFileInfo(LocalFileNativesManager.java:77)
    at org.eclipse.core.internal.filesystem.local.LocalFile.fetchInfo(LocalFile.java:150)
    at org.eclipse.core.filesystem.provider.FileStore.fetchInfo(FileStore.java:280)
    at org.eclipse.core.internal.localstore.FileSystemResourceManager.read(FileSystemResourceManager.java:778)
    at org.eclipse.core.internal.resources.File.getContents(File.java:290)
    at org.eclipse.dltk.internal.core.util.Util.getResourceContentsAsCharArray(Util.java:534)
    at org.eclipse.dltk.internal.core.util.Util.getResourceContentsAsCharArray(Util.java:491)
    at org.eclipse.dltk.internal.core.SourceModule.getBufferContent(SourceModule.java:405)
    at org.eclipse.dltk.internal.core.AbstractSourceModule.openBuffer(AbstractSourceModule.java:641)
    at org.eclipse.dltk.internal.core.AbstractSourceModule.buildStructure(AbstractSourceModule.java:487)
    at org.eclipse.dltk.internal.core.Openable.generateInfos(Openable.java:195)
    at org.eclipse.dltk.internal.core.SourceRefElement.generateInfos(SourceRefElement.java:59)
    at org.eclipse.dltk.internal.core.ModelElement.openWhenClosed(ModelElement.java:196)
    at org.eclipse.dltk.internal.core.ModelElement.getElementInfo(ModelElement.java:183)
    at org.eclipse.dltk.internal.core.ModelElement.getElementInfo(ModelElement.java:165)
    at org.eclipse.dltk.internal.core.Member.getNamespace(Member.java:60)
    at org.eclipse.dltk.internal.core.NamedMember.getFullyQualifiedName(NamedMember.java:45)
    at org.eclipse.dltk.internal.core.SourceType.getFullyQualifiedName(SourceType.java:228)
    at org.eclipse.dltk.internal.core.SourceType.getFullyQualifiedName(SourceType.java:240)
    at org.eclipse.dltk.core.search.matching.PossibleMatch.getQualifiedName(PossibleMatch.java:123)
    at org.eclipse.dltk.core.search.matching.PossibleMatch.<init>(PossibleMatch.java:45)
    at org.eclipse.dltk.core.search.matching.PossibleMatch.<init>(PossibleMatch.java:36)
    at org.eclipse.dltk.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:667)
    at org.eclipse.dltk.core.search.DLTKSearchParticipant.locateMatches(DLTKSearchParticipant.java:103)
    at org.eclipse.dltk.core.index2.search.NewSearchEngine.findMatches(NewSearchEngine.java:180)
    at org.eclipse.dltk.core.index2.search.NewSearchEngine.search(NewSearchEngine.java:89)
    at org.eclipse.dltk.core.search.SearchEngine.search(SearchEngine.java:363)
    at org.phpsrc.eclipse.pti.core.search.PHPSearchEngine.findMatches(PHPSearchEngine.java:70)
    at org.phpsrc.eclipse.pti.core.search.PHPSearchEngine.findClass(PHPSearchEngine.java:63)
    at org.phpsrc.eclipse.pti.core.search.PHPSearchEngine.findClass(PHPSearchEngine.java:53)
    at org.phpsrc.eclipse.pti.core.PHPToolkitUtil.hasSuperClass(PHPToolkitUtil.java:459)
    at org.phpsrc.eclipse.pti.core.PHPToolkitUtil.hasSuperClass(PHPToolkitUtil.java:437)
    at org.phpsrc.eclipse.pti.core.PHPToolkitUtil.hasSuperClass(PHPToolkitUtil.java:465)

The last two lines are repeated until Java's stack size has been reached.

The installation info for the plugin:

PHP Tool Integration Core   1.6.0.R20111119000000   org.phpsrc.eclipse.pti.core.feature.group   Sven Kiera
giosh94mhz commented 8 years ago

+1

This also happen in Neon for generic PHPUnit_Framework_TestCase tests:

!ENTRY org.eclipse.core.jobs 4 2 2016-08-03 10:49:11.106
!MESSAGE An internal error occurred during: "PHPUnit".
!STACK 0
java.lang.StackOverflowError
        at org.eclipse.core.runtime.Path.initialize(Path.java:644)
        at org.eclipse.core.runtime.Path.<init>(Path.java:238)
        at org.eclipse.core.runtime.Path.<init>(Path.java:186)
        at org.eclipse.dltk.internal.core.search.DLTKSearchScope.getPath(DLTKSearchScope.java:599)
        at org.eclipse.dltk.internal.core.search.DLTKSearchScope.getPath(DLTKSearchScope.java:601)
        at org.eclipse.dltk.internal.core.search.DLTKSearchScope.getPath(DLTKSearchScope.java:604)
        at org.eclipse.dltk.internal.core.search.DLTKSearchScope.getPath(DLTKSearchScope.java:604)
        at org.eclipse.dltk.internal.core.search.DLTKSearchScope.encloses(DLTKSearchScope.java:576)
        at org.eclipse.dltk.core.search.matching.MatchLocator.encloses(MatchLocator.java:431)
        at org.eclipse.dltk.core.search.matching.MatchLocator.reportMatching(MatchLocator.java:1032)
        at org.eclipse.php.internal.core.search.PHPMatchLocator.reportMatching(PHPMatchLocator.java:226)
        at org.eclipse.dltk.core.search.matching.MatchLocator.reportMatching(MatchLocator.java:1075)
        at org.eclipse.php.internal.core.search.PHPMatchLocator.reportMatching(PHPMatchLocator.java:226)
        at org.eclipse.dltk.core.search.matching.MatchLocator.reportMatching(MatchLocator.java:950)
        at org.eclipse.dltk.core.search.matching.MatchLocator.process(MatchLocator.java:804)
        at org.eclipse.dltk.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:507)
        at org.eclipse.dltk.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:575)
        at org.eclipse.dltk.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:680)
        at org.eclipse.dltk.core.search.DLTKSearchParticipant.locateMatches(DLTKSearchParticipant.java:102)
        at org.eclipse.dltk.core.index2.search.NewSearchEngine.findMatches(NewSearchEngine.java:180)
        at org.eclipse.dltk.core.index2.search.NewSearchEngine.search(NewSearchEngine.java:89)
        at org.eclipse.dltk.core.search.SearchEngine.search(SearchEngine.java:363)
        at org.phpsrc.eclipse.pti.core.search.PHPSearchEngine.findMatches(PHPSearchEngine.java:70)
        at org.phpsrc.eclipse.pti.core.search.PHPSearchEngine.findClass(PHPSearchEngine.java:63)
        at org.phpsrc.eclipse.pti.core.search.PHPSearchEngine.findClass(PHPSearchEngine.java:53)
        at org.phpsrc.eclipse.pti.core.PHPToolkitUtil.hasSuperClass(PHPToolkitUtil.java:412)
        # then a lot of this two lines
        at org.phpsrc.eclipse.pti.core.PHPToolkitUtil.hasSuperClass(PHPToolkitUtil.java:391)
        at org.phpsrc.eclipse.pti.core.PHPToolkitUtil.hasSuperClass(PHPToolkitUtil.java:418)