String (final CharSequence text, final Lexer lexer) { final StringBuilder buffer = new StringBuilder(); while (true) { if (lexer.getTokenType() != JavaTokenType.IDENTIFIER && lexer.getTokenType() != JavaTokenType.ASTERISK) { break; } buffer.append(text, lexer.getTokenStart(), lexer.getTokenEnd()); advanceLexer(lexer); if (lexer.getTokenType() != JavaTokenType.DOT) { break; } buffer.append('.'); advanceLexer(lexer); } String packageName = buffer.toString(); if (packageName.length() == 0 || StringUtil.endsWithChar(packageName, '.') || StringUtil.startsWithChar(packageName, '*')) { return null; } return packageName; }