Zxing скомпилировал 2.0 с Java 1.5 - PullRequest
0 голосов
/ 14 марта 2012

Привет! Я использовал модуль javase zxing.Я прочитал zxing начало работы , и я попытался скомпилировать core и javase-модули (с JDK 1.5.0_22)

Я запускаю ant-скрипт в основной папке, у меня есть эта ошибка:

[javac] javac: invalid target release: 6

Если я изменю сценарий ant build.xml в основной папке, заменив target=6 на target=5 и source=6 на source=5 У меня 42 ошибки компиляции:

init:

build:
    [javac] Compiling 169 source files to D:\ZXing-2.0\zxing-2.0\core\build
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\MultiFormatReader.j
ava:52: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\MultiFormatReader.j
ava:66: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\MultiFormatReader.j
ava:157: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\MultiFormatWriter.j
ava:40: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\MultiFormatWriter.j
ava:48: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\aztec\AztecReader.j
ava:52: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\aztec\AztecReader.j
ava:57: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\aztec\AztecReader.j
ava:89: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\datamatrix\DataMatr
ixReader.java:57: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\datamatrix\DataMatr
ixReader.java:62: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\datamatrix\DataMatr
ixReader.java:89: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\datamatrix\detector
\Detector.java:444: method does not override a method from its superclass
    [javac]     @Override
    [javac]      ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\maxicode\MaxiCodeRe
ader.java:58: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\maxicode\MaxiCodeRe
ader.java:63: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\maxicode\MaxiCodeRe
ader.java:84: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\multi\ByQuadrantRea
der.java:46: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\multi\ByQuadrantRea
der.java:52: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\multi\ByQuadrantRea
der.java:95: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\multi\GenericMultip
leBarcodeReader.java:55: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\multi\GenericMultip
leBarcodeReader.java:60: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\qrcode\QRCodeReader
.java:61: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\qrcode\QRCodeReader
.java:66: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\qrcode\QRCodeReader
.java:93: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\multi\qrcode\QRCode
MultiReader.java:47: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\multi\qrcode\QRCode
MultiReader.java:52: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\qrcode\detector\Fin
derPatternFinder.java:557: method does not override a method from its superclass

    [javac]     @Override
    [javac]      ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\qrcode\detector\Fin
derPatternFinder.java:573: method does not override a method from its superclass

    [javac]     @Override
    [javac]      ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\multi\qrcode\detect
or\MultiFinderPatternFinder.java:80: method does not override a method from its
superclass
    [javac]     @Override
    [javac]      ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\oned\OneDReader.jav
a:47: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\oned\OneDReader.jav
a:53: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\oned\OneDReader.jav
a:87: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\oned\OneDimensional
CodeWriter.java:40: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\oned\OneDimensional
CodeWriter.java:53: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\oned\UPCAWriter.jav
a:36: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\oned\UPCAWriter.jav
a:42: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\pdf417\PDF417Reader
.java:53: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\pdf417\PDF417Reader
.java:58: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\pdf417\PDF417Reader
.java:76: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\pdf417\encoder\PDF4
17Writer.java:32: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\pdf417\encoder\PDF4
17Writer.java:41: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\qrcode\QRCodeWriter
.java:40: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] D:\ZXing-2.0\zxing-2.0\core\src\com\google\zxing\qrcode\QRCodeWriter
.java:47: method does not override a method from its superclass
    [javac]   @Override
    [javac]    ^
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 42 errors

BUILD FAILED
D:\ZXing-2.0\zxing-2.0\core\build.xml:37: Compile failed; see the compiler error
 output for details.

Спасибо

Ответы [ 3 ]

3 голосов
/ 14 марта 2012

Это синтаксис Java 6, который не может быть проанализирован Java 5 javac.

Установите и используйте Java 6 JDK, который имеет Java 6 javac.

(Если вы не можете сделать это,Вы можете поэкспериментировать с использованием компилятора Eclipse, который может компилировать исходные коды Java 6 с использованием Java 5 JVM - http://help.eclipse.org/indigo/topic/org.eclipse.jdt.doc.user/tasks/task-ant_javac_adapter.htm - вам также необходимо загрузить соответствующую версию ecj.jar)

2 голосов
/ 14 марта 2012

Вы должны использовать javac версии 6 с опциями -source 6 и -target 5! Смотри также этот вопрос .

ОБНОВЛЕНИЕ: удалить параметр -source, который должен работать с использованием javac версия 6

> javac -version
javac 1.6.0_22
> javac -target 5 ...
0 голосов
/ 01 марта 2013

Работает нормально для zxing-2.1. Я сделал следующие изменения:

build.xml:

<target name="build" depends="init">
  <mkdir dir="build"/>
  <javac srcdir="src"
     destdir="build"
     source="5"
     target="5"

pom.xml

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>2.4</version>
  <configuration>
    <source>5</source>
    <target>5</target>
  </configuration>
</plugin>

И смог без проблем скомпилировать (mvn clean package) как ядро, так и javase.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...