Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

...internal.Iterables is used in Asserts generated by assertj-assertions-generator (java9)

未关闭
#197 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
java
领域
tooling

调研方向

首先检查生成 org.assertj.core.internal.Iterables 导入的断言生成路径,然后在 Java 9+ 模块化项目中复现生成代码的编译失败。完成标准是生成的断言不再依赖未导出的内部类,并且能够在 Java 9 及更高版本上成功编译。

由索引模型根据 Issue 内容生成。

描述

Summary

Hi,
I am migrating from java 8 to 17 and had big trouble getting the generated assertions to work (actually is does not work at all, is it dead?)

But even with great hacks I cannot get arround that the generated code imports the internal class org.assertj.core.internal.Iterables which is (of course) not exported by assertj-core. Could this become public? Or could the code-generator be updated? Which btw has medium CVEs in it's dependencies.

Example
import org.assertj.core.internal.Iterables;
//this is part of the generated code
public YAssert hasXs(X... xs) {
    // check that actual Y we want to make assertions on is not null.
    isNotNull();

    // check that given X varargs is not null.
    if (x== null) failWithMessage("Expecting x parameter not to be null.");

    // check with standard error message, to set another message call: info.overridingErrorMessage("my error message");
    Iterables.instance().assertContains(info, actual.getX(), xs);

    // return the current assertion for method chaining
    return this;
  }

Package 'org.assertj.core.internal' is declared in module 'org.assertj.core', which does not export it to module 'my.assertions'

In other words: Is does not compile in Java > 8 which renders the complete code generation useless.

主要语言
Java
星标
72
派生
47
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

assertj/assertj-generator 的其他 Issue

查看 assertj/assertj-generator 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。