java,为什么会出现这些错误? --maven-compiler-plugin:3.7.0
java, why these error? --maven-compiler-plugin:3.7.0
我正在浏览以下 opendaylight 指南:
https://docs.opendaylight.org/en/stable-oxygen/developer-guide/developing-apps-on-the-opendaylight-controller.html#
编译过程中出现错误:
[ERROR] ...Odl-testProvider.java:[14,17] '{' expected
[ERROR] ...Odl-testProvider.java:[21,15] <identifier> expected
[ERROR] ...Odl-testProvider.java:[21,16] invalid method declaration; return type required
Odl-testProvider.java:
/*
* Copyright © 2017 Copyright(c) Yoyodyne, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.solaroi.impl;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Odl-testProvider //line 14
{
private static final Logger LOG = LoggerFactory.getLogger(Odl-testProvider.class);
private final DataBroker dataBroker;
public Odl-testProvider(final DataBroker dataBroker) //line 21
{
this.dataBroker = dataBroker;
}
/**
* Method called when the blueprint container is created.
*/
public void init()
{
LOG.info("Odl-testProvider Session Initiated");
}
/**
* Method called when the blueprint container is destroyed.
*/
public void close()
{
LOG.info("Odl-testProvider Closed");
}
}
编译器信息:
goal: maven-compiler-plugin:3.7.0:compile(default-compile)
compiler 'javac', source = 1.8, target = 1.8
您必须查看 Java class 名称允许的字符。 -
是不允许的。看这里:https://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.8
我正在浏览以下 opendaylight 指南: https://docs.opendaylight.org/en/stable-oxygen/developer-guide/developing-apps-on-the-opendaylight-controller.html#
编译过程中出现错误:
[ERROR] ...Odl-testProvider.java:[14,17] '{' expected
[ERROR] ...Odl-testProvider.java:[21,15] <identifier> expected
[ERROR] ...Odl-testProvider.java:[21,16] invalid method declaration; return type required
Odl-testProvider.java:
/*
* Copyright © 2017 Copyright(c) Yoyodyne, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.solaroi.impl;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Odl-testProvider //line 14
{
private static final Logger LOG = LoggerFactory.getLogger(Odl-testProvider.class);
private final DataBroker dataBroker;
public Odl-testProvider(final DataBroker dataBroker) //line 21
{
this.dataBroker = dataBroker;
}
/**
* Method called when the blueprint container is created.
*/
public void init()
{
LOG.info("Odl-testProvider Session Initiated");
}
/**
* Method called when the blueprint container is destroyed.
*/
public void close()
{
LOG.info("Odl-testProvider Closed");
}
}
编译器信息:
goal: maven-compiler-plugin:3.7.0:compile(default-compile)
compiler 'javac', source = 1.8, target = 1.8
您必须查看 Java class 名称允许的字符。 -
是不允许的。看这里:https://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.8