diff --git a/tests/samples/codefiles/java.java b/tests/samples/codefiles/java.java index 703be20..f62cc07 100644 --- a/tests/samples/codefiles/java.java +++ b/tests/samples/codefiles/java.java @@ -5,6 +5,8 @@ import static com.googlecode.javacv.jna.highgui.cvReleaseCapture; import javax.servlet.*; import com.colorfulwolf.webcamapplet.gui.ImagePanel; import com.foobar.*; +import package com.apackage.something; +import namespace com.anamespace.other; public class Hello extends GenericServlet { public void service(final ServletRequest request, final ServletResponse response) diff --git a/tests/test_dependencies.py b/tests/test_dependencies.py index 86d6c10..6f2d406 100644 --- a/tests/test_dependencies.py +++ b/tests/test_dependencies.py @@ -236,9 +236,12 @@ class DependenciesTestCase(TestCase): expected_dependencies=[ 'colorfulwolf.webcamapplet', 'foobar', + 'googlecode.javacv', + 'apackage.something', + 'anamespace.other', ], expected_language='Java', - expected_lines=20, + expected_lines=22, entity='java.java', ) diff --git a/wakatime/dependencies/jvm.py b/wakatime/dependencies/jvm.py index 3af3fcb..421474d 100644 --- a/wakatime/dependencies/jvm.py +++ b/wakatime/dependencies/jvm.py @@ -43,7 +43,7 @@ class JavaParser(TokenParser): self._process_other(token, content) def _process_namespace(self, token, content): - if u(content) == u('import'): + if u(content).split() and u(content).split()[0] == u('import'): self.state = 'import' elif self.state == 'import':